]> granicus.if.org Git - vim/commitdiff
patch 8.1.0937: invalid memory access in search pattern v8.1.0937
authorBram Moolenaar <Bram@vim.org>
Sun, 17 Feb 2019 12:53:34 +0000 (13:53 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 17 Feb 2019 12:53:34 +0000 (13:53 +0100)
Problem:    Invalid memory access in search pattern. (Kuang-che Wu)
Solution:   Check for incomplete collation element. (Dominique Pelle,
            closes #3985)

src/regexp.c
src/testdir/test_regexp_latin.vim
src/version.c

index 83620489516aa056fe389d928a827c7ae511ae4a..e37c065079b1285af4d2a3bf3f3e8bd7bc99cb1c 100644 (file)
@@ -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);
index d63b4f9580603d10819a7de374f32b9844b6f785..d30312a11e2580477c232db87a3404f59502d770 100644 (file)
@@ -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()
index 81bafe5781af12c0d5b4155c9d1edd8ab65dc617..8509e0666c009dee916885aae8915cfdde95c772 100644 (file)
@@ -779,6 +779,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    937,
 /**/
     936,
 /**/