# HG changeset patch # User Christian Brabandt # Date 1487870104 -3600 # Node ID 3b82ab325d5914b4f3ef3e2bb2a4f817065d511b # Parent ae3832cc9a28e9aad2df2f56b57baf768735659d patch 8.0.0358: invalid memory access in C-indent code commit https://github.com/vim/vim/commit/60629d642541a089c322e65963c0a77e5f77eb79 Author: Bram Moolenaar Date: Thu Feb 23 18:08:56 2017 +0100 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 https://github.com/vim/vim/issues/1492) diff --git a/src/edit.c b/src/edit.c --- 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 --- 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 --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 358, +/**/ 357, /**/ 356,