Patch 8.2.4925

6 views
Skip to first unread message

Bram Moolenaar

unread,
May 9, 2022, 8:16:11 AM5/9/22
to vim...@googlegroups.com

Patch 8.2.4925
Problem: Trailing backslash may cause reading past end of line.
Solution: Check for NUL after backslash.
Files: src/textobject.c, src/testdir/test_textobjects.vim


*** ../vim-8.2.4924/src/textobject.c 2021-07-31 12:31:37.331213775 +0100
--- src/textobject.c 2022-05-09 13:13:10.846847043 +0100
***************
*** 1664,1670 ****
--- 1664,1674 ----
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)
*** ../vim-8.2.4924/src/testdir/test_textobjects.vim 2021-11-21 11:35:59.460938795 +0000
--- src/testdir/test_textobjects.vim 2022-05-09 13:10:19.830955528 +0100
***************
*** 185,194 ****
call assert_equal("<div><div\nattr=\"attr\"\n></div></div>", @", e)

set quoteescape&
endfor

set enc=utf-8
- bwipe!
endfunc

func Test_empty_html_tag()
--- 185,202 ----
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
endfunc

func Test_empty_html_tag()
*** ../vim-8.2.4924/src/version.c 2022-05-09 12:16:14.761073336 +0100
--- src/version.c 2022-05-09 13:14:36.506811983 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4925,
/**/

--
hundred-and-one symptoms of being an internet addict:
146. You experience ACTUAL physical withdrawal symptoms when away
from your 'puter and the net.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages