# HG changeset patch # User Bram Moolenaar # Date 1550408406 -3600 # Node ID 9cd9bf2897dee6cdff1a5963cd85cf5641cde72c # Parent e8fef9635b72d473cc43dd5b98683d708d1cf766 patch 8.1.0937: invalid memory access in search pattern commit https://github.com/vim/vim/commit/f1b57ab2ab18032d19f64bff7d22f3adb3fe93f7 Author: Bram Moolenaar Date: Sun Feb 17 13:53:34 2019 +0100 patch 8.1.0937: invalid memory access in search pattern Problem: Invalid memory access in search pattern. (Kuang-che Wu) Solution: Check for incomplete collation element. (Dominique Pelle, closes #3985) diff --git a/src/regexp.c b/src/regexp.c --- 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 --- 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 --- 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,