mirror of
https://github.com/neovim/neovim.git
synced 2024-12-22 04:05:09 -07:00
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:
parent
d8b4fb7838
commit
279ecaff00
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user