vim-patch:8.2.0112: illegal memory access when using 'cindent'

Problem:    Illegal memory access when using 'cindent'.
Solution:   Check for NUL byte. (Dominique Pelle, closes vim/vim#5470)
02ad46394e
This commit is contained in:
Jan Edmund Lazo
2020-01-12 18:40:27 -05:00
parent fd89ad7bfb
commit 03da3697a4
2 changed files with 12 additions and 0 deletions

View File

@@ -461,6 +461,9 @@ cin_iscase (
if (cin_starts_with(s, "case")) {
for (s += 4; *s; ++s) {
s = cin_skipcomment(s);
if (*s == NUL) {
break;
}
if (*s == ':') {
if (s[1] == ':') /* skip over "::" for C++ */
++s;

View File

@@ -118,4 +118,13 @@ b = something();
bw!
endfunc
" this was going beyond the end of the line.
func Test_cindent_case()
new
call setline(1, "case x: // x")
set cindent
norm! f:a:
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab