diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-02-16 17:07:47 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-02-16 17:07:47 +0100 |
commit | 985079c514e9ab85598b7bca019c77d3e42526f5 (patch) | |
tree | 5e2dbfc05e6504a9e71d3683f69c215f7eddf0da | |
parent | 6982f42f33b2868e4b9884514cfe8e357b727498 (diff) |
patch 8.1.0934: invalid memory access in search patternv8.1.0934
Problem: Invalid memory access in search pattern. (Kuang-che Wu)
Solution: Check for incomplete equivalence class. (closes #3970)
-rw-r--r-- | src/regexp.c | 2 | ||||
-rw-r--r-- | src/testdir/test_regexp_latin.vim | 7 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 10 insertions, 1 deletions
diff --git a/src/regexp.c b/src/regexp.c index f06e15c833..30a604b236 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -730,7 +730,7 @@ get_equi_class(char_u **pp) int l = 1; char_u *p = *pp; - if (p[1] == '=') + if (p[1] == '=' && p[2] != NUL) { if (has_mbyte) l = (*mb_ptr2len)(p + 2); diff --git a/src/testdir/test_regexp_latin.vim b/src/testdir/test_regexp_latin.vim index bcac6c72c8..09104a1423 100644 --- a/src/testdir/test_regexp_latin.vim +++ b/src/testdir/test_regexp_latin.vim @@ -97,3 +97,10 @@ func Test_out_of_memory() " This will be slow... call assert_fails('call search("\\v((n||<)+);")', 'E363:') endfunc + +func Test_get_equi_class() + new + " Incomplete equivalence class caused invalid memory access + s/^/[[= + call assert_equal(1, search(getline(1))) +endfunc diff --git a/src/version.c b/src/version.c index 21b9217878..dbf4083419 100644 --- a/src/version.c +++ b/src/version.c @@ -780,6 +780,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 934, +/**/ 933, /**/ 932, |