mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.0046: reading past end of completion with duplicate match
Problem: Reading past end of completion with duplicate match.
Solution: Check string length
baefde1455
This commit is contained in:
parent
c366a63e4c
commit
5d1f0c3eca
@ -709,7 +709,7 @@ static int ins_compl_add(char_u *const str, int len, char_u *const fname,
|
||||
do {
|
||||
if (!match_at_original_text(match)
|
||||
&& STRNCMP(match->cp_str, str, len) == 0
|
||||
&& match->cp_str[len] == NUL) {
|
||||
&& ((int)STRLEN(match->cp_str) <= len || match->cp_str[len] == NUL)) {
|
||||
FREE_CPTEXT(cptext, cptext_allocated);
|
||||
return NOTDONE;
|
||||
}
|
||||
|
@ -969,5 +969,15 @@ func Test_infercase_very_long_line()
|
||||
set noic noinfercase
|
||||
endfunc
|
||||
|
||||
func Test_ins_complete_add()
|
||||
" this was reading past the end of allocated memory
|
||||
new
|
||||
norm o
|
||||
norm 7o
|
||||
sil! norm o
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
Loading…
Reference in New Issue
Block a user