vim-patch:8.0.0333

Problem:    Illegal memory access when 'complete' ends in a backslash.
Solution:   Check for trailing backslash. (Dominique Pelle, closes vim/vim#1478)

226c534291
This commit is contained in:
ckelsel 2017-09-24 10:05:53 +08:00
parent 4bb0e95abb
commit 2b53a565b9
3 changed files with 15 additions and 4 deletions

View File

@ -2997,9 +2997,10 @@ did_set_string_option (
if (s[-1] == 'k' || s[-1] == 's') {
/* skip optional filename after 'k' and 's' */
while (*s && *s != ',' && *s != ' ') {
if (*s == '\\')
++s;
++s;
if (*s == '\\' && s[1] != NUL) {
s++;
}
s++;
}
} else {
if (errbuf != NULL) {

View File

@ -103,3 +103,13 @@ func Test_keymap_valid()
call assert_fails(":set kmp=trunc\x00name", "E544:")
call assert_fails(":set kmp=trunc\x00name", "trunc")
endfunc
func Test_complete()
" Trailing single backslash used to cause invalid memory access.
set complete=s\
new
call feedkeys("i\<C-N>\<Esc>", 'xt')
bwipe!
set complete&
endfun

View File

@ -619,7 +619,7 @@ static const int included_patches[] = {
// 336,
// 335,
// 334,
// 333,
333,
// 332,
331,
// 330,