Skip to content
Permalink
Browse files Browse the repository at this point in the history
patch 8.2.4968: reading past end of the line when C-indenting
Problem:    Reading past end of the line when C-indenting.
Solution:   Check for NUL.
  • Loading branch information
brammool committed May 16, 2022
1 parent 3c25a86 commit 60ae0e7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cindent.c
Expand Up @@ -89,7 +89,7 @@ skip_string(char_u *p)
while (vim_isdigit(p[i - 1])) // '\000'
++i;
}
if (p[i] == '\'') // check for trailing '
if (p[i - 1] != NUL && p[i] == '\'') // check for trailing '
{
p += i;
continue;
Expand Down
7 changes: 7 additions & 0 deletions src/testdir/test_cindent.vim
Expand Up @@ -5319,6 +5319,13 @@ func Test_cindent_change_multline()
close!
endfunc

" This was reading past the end of the line
func Test_cindent_check_funcdecl()
new
sil norm o0('\0=L
bwipe!
endfunc

func Test_cindent_scopedecls()
new
setl cindent ts=4 sw=4
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -746,6 +746,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4968,
/**/
4967,
/**/
Expand Down

0 comments on commit 60ae0e7

Please sign in to comment.