diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-02-17 13:53:34 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-02-17 13:53:34 +0100 |
commit | f1b57ab2ab18032d19f64bff7d22f3adb3fe93f7 (patch) | |
tree | efdcc48f4367cf3a7954c300a1922e96ee9ff86a | |
parent | 55c77cf2ea9c15e1ec75d1faf702ec3c9e325271 (diff) |
patch 8.1.0937: invalid memory access in search patternv8.1.0937
Problem: Invalid memory access in search pattern. (Kuang-che Wu)
Solution: Check for incomplete collation element. (Dominique Pelle,
closes #3985)
-rw-r--r-- | src/regexp.c | 2 | ||||
-rw-r--r-- | src/testdir/test_regexp_latin.vim | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 5 insertions, 1 deletions
diff --git a/src/regexp.c b/src/regexp.c index 8362048951..e37c065079 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -1111,7 +1111,7 @@ get_coll_element(char_u **pp) int l = 1; char_u *p = *pp; - if (p[0] != NUL && p[1] == '.') + if (p[0] != NUL && 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 d63b4f9580..d30312a11e 100644 --- a/src/testdir/test_regexp_latin.vim +++ b/src/testdir/test_regexp_latin.vim @@ -103,6 +103,8 @@ func Test_get_equi_class() " Incomplete equivalence class caused invalid memory access s/^/[[= call assert_equal(1, search(getline(1))) + s/.*/[[. + call assert_equal(1, search(getline(1))) endfunc func Test_rex_init() diff --git a/src/version.c b/src/version.c index 81bafe5781..8509e0666c 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 */ /**/ + 937, +/**/ 936, /**/ 935, |