]> granicus.if.org Git - vim/commitdiff
patch 8.0.0358: invalid memory access in C-indent code v8.0.0358
authorBram Moolenaar <Bram@vim.org>
Thu, 23 Feb 2017 17:08:56 +0000 (18:08 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 23 Feb 2017 17:08:56 +0000 (18:08 +0100)
Problem:    Invalid memory access in C-indent code.
Solution:   Don't go over end of empty line. (Dominique Pelle, closes #1492)

src/edit.c
src/testdir/test_options.vim
src/version.c

index 25a123e8891ccb29e317258f4e2dccfb7d11bf78..c4e7ddd189cdcf7b66638c847850ee52aa7b90ef 100644 (file)
@@ -8181,7 +8181,8 @@ in_cinkeys(
        {
            if (try_match && *look == keytyped)
                return TRUE;
-           ++look;
+           if (*look != NUL)
+               ++look;
        }
 
        /*
index 1ee1f8fa8102db26823b3570880bf0a353da2ea9..076d8b2db3a9bf387b0803490bb4dbd2dcb239a4 100644 (file)
@@ -135,6 +135,13 @@ func Check_dir_option(name)
   call assert_fails("set " . a:name . "=/not.*there", "E474:")
 endfunc
 
+func Test_cinkeys()
+  " This used to cause invalid memory access
+  set cindent cinkeys=0
+  norm a
+  set cindent& cinkeys&
+endfunc
+
 func Test_dictionary()
   call Check_dir_option('dictionary')
 endfunc
index 2d076cc14c72b42b4dec4568448a046436ff3491..9de1850de4725190bb132e8775375b2392379437 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    358,
 /**/
     357,
 /**/