Permalink
Browse files

patch 8.0.0333: illegal memory access when 'complete' ends in a backs…

…lash

Problem:    Illegal memory access when 'complete' ends in a backslash.
Solution:   Check for trailing backslash. (Dominique Pelle, closes #1478)
  • Loading branch information...
brammool committed Feb 17, 2017
1 parent 4e9dbc7 commit 226c53429109f24e31c17016aedfd7fbf7a9aa50
Showing with 12 additions and 1 deletion.
  1. +1 −1 src/option.c
  2. +9 −0 src/testdir/test_options.vim
  3. +2 −0 src/version.c
View
@@ -7017,7 +7017,7 @@ did_set_string_option(
/* skip optional filename after 'k' and 's' */
while (*s && *s != ',' && *s != ' ')
{
- if (*s == '\\')
+ if (*s == '\\' && s[1] != NUL)
++s;
++s;
}
@@ -136,6 +136,15 @@ func Test_thesaurus()
call Check_dir_option('thesaurus')
endfun
+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
+
func Test_set_completion()
call feedkeys(":set di\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"set dictionary diff diffexpr diffopt digraph directory display', @:)
View
@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 333,
/**/
332,
/**/

0 comments on commit 226c534

Please sign in to comment.