From f1b57ab2ab18032d19f64bff7d22f3adb3fe93f7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 17 Feb 2019 13:53:34 +0100 Subject: [PATCH] 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) --- src/regexp.c | 2 +- src/testdir/test_regexp_latin.vim | 2 ++ src/version.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/regexp.c b/src/regexp.c index 836204895..e37c06507 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 d63b4f958..d30312a11 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 81bafe578..8509e0666 100644 --- a/src/version.c +++ b/src/version.c @@ -779,6 +779,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 937, /**/ 936, /**/ -- 2.50.1