Skip to content

Commit

Permalink
patch 8.2.4925: trailing backslash may cause reading past end of line
Browse files Browse the repository at this point in the history
Problem:    Trailing backslash may cause reading past end of line.
Solution:   Check for NUL after backslash.
  • Loading branch information
brammool committed May 9, 2022
1 parent 0519ce0 commit 53a7028
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/testdir/test_textobjects.vim
Expand Up @@ -185,10 +185,18 @@ func Test_string_html_objects()
call assert_equal("<div><div\nattr=\"attr\"\n></div></div>", @", e)

set quoteescape&

" this was going beyond the end of the line
%del
sil! norm i"\
sil! norm i"\
sil! norm i"\
call assert_equal('"\', getline(1))

bwipe!
endfor

set enc=utf-8
bwipe!
endfunc

func Test_empty_html_tag()
Expand Down
4 changes: 4 additions & 0 deletions src/textobject.c
Expand Up @@ -1664,7 +1664,11 @@ find_next_quote(
if (c == NUL)
return -1;
else if (escape != NULL && vim_strchr(escape, c))
{
++col;
if (line[col] == NUL)
return -1;
}
else if (c == quotechar)
break;
if (has_mbyte)
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 */
/**/
4925,
/**/
4924,
/**/
Expand Down

0 comments on commit 53a7028

Please sign in to comment.