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
index 8362048..e37c065 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -1111,7 +1111,7 @@
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 d63b4f9..d30312a 100644
--- a/src/testdir/test_regexp_latin.vim
+++ b/src/testdir/test_regexp_latin.vim
@@ -103,6 +103,8 @@
" 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 81bafe5..8509e06 100644
--- a/src/version.c
+++ b/src/version.c
@@ -780,6 +780,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 937,
+/**/
936,
/**/
935,