vim-patch:8.1.0934: invalid memory access in search pattern

Problem:    Invalid memory access in search pattern. (Kuang-che Wu)
Solution:   Check for incomplete equivalence class. (closes vim/vim#3970)
985079c514
This commit is contained in:
Jan Edmund Lazo 2019-02-17 19:34:19 -05:00
parent d8b4fb7838
commit 279ecaff00
2 changed files with 8 additions and 1 deletions

View File

@ -772,7 +772,7 @@ static int get_equi_class(char_u **pp)
int l = 1;
char_u *p = *pp;
if (p[1] == '=') {
if (p[1] == '=' && p[2] != NUL) {
l = (*mb_ptr2len)(p + 2);
if (p[l + 2] == '=' && p[l + 3] == ']') {
c = utf_ptr2char(p + 2);

View File

@ -38,3 +38,10 @@ func Test_range_with_newline()
call assert_equal(0, search("[ -*\\t-\\n]"))
bwipe!
endfunc
func Test_get_equi_class()
new
" Incomplete equivalence class caused invalid memory access
s/^/[[=
call assert_equal(1, search(getline(1)))
endfunc