vim-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 vim/vim#3985)
f1b57ab2ab
This commit is contained in:
Jan Edmund Lazo 2019-02-17 19:36:21 -05:00
parent 279ecaff00
commit 486234ab3d
2 changed files with 3 additions and 1 deletions

View File

@ -1103,7 +1103,7 @@ static int 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) {
l = utfc_ptr2len(p + 2);
if (p[l + 2] == '.' && p[l + 3] == ']') {
c = utf_ptr2char(p + 2);

View File

@ -44,4 +44,6 @@ 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