]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4925: trailing backslash may cause reading past end of line v8.2.4925
authorBram Moolenaar <Bram@vim.org>
Mon, 9 May 2022 12:15:07 +0000 (13:15 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 9 May 2022 12:15:07 +0000 (13:15 +0100)
Problem:    Trailing backslash may cause reading past end of line.
Solution:   Check for NUL after backslash.

src/testdir/test_textobjects.vim
src/textobject.c
src/version.c

index debbfb357bf892c35ac83130b33e579b07881fe9..34894d068a2a413c6ef3a9018471578fa2a46b1d 100644 (file)
@@ -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 \16i"\
+    sil! norm \16i"\
+    sil! norm \16i"\
+    call assert_equal('"\', getline(1))
+
+    bwipe!
   endfor
 
   set enc=utf-8
-  bwipe!
 endfunc
 
 func Test_empty_html_tag()
index e4a7db38ed42cdbc3b5444f9184048d29697dbc6..edaa64c51cc3ad34b0e5ac110831452c0312a418 100644 (file)
@@ -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)
index d790a754035f7ad9e9a603b0567660fbf2165246..8f33f05aac2e7df800543ff488e6effac294845b 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4925,
 /**/
     4924,
 /**/