From: Bram Moolenaar Date: Thu, 23 Feb 2017 17:08:56 +0000 (+0100) Subject: patch 8.0.0358: invalid memory access in C-indent code X-Git-Tag: v8.0.0358 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60629d642541a089c322e65963c0a77e5f77eb79;p=vim patch 8.0.0358: invalid memory access in C-indent code Problem: Invalid memory access in C-indent code. Solution: Don't go over end of empty line. (Dominique Pelle, closes #1492) --- diff --git a/src/edit.c b/src/edit.c index 25a123e88..c4e7ddd18 100644 --- a/src/edit.c +++ b/src/edit.c @@ -8181,7 +8181,8 @@ in_cinkeys( { if (try_match && *look == keytyped) return TRUE; - ++look; + if (*look != NUL) + ++look; } /* diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim index 1ee1f8fa8..076d8b2db 100644 --- a/src/testdir/test_options.vim +++ b/src/testdir/test_options.vim @@ -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 diff --git a/src/version.c b/src/version.c index 2d076cc14..9de1850de 100644 --- a/src/version.c +++ b/src/version.c @@ -764,6 +764,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 358, /**/ 357, /**/