Patch 8.2.3950

7 views
Skip to first unread message

Bram Moolenaar

unread,
Dec 30, 2021, 10:29:53 AM12/30/21
to vim...@googlegroups.com

Patch 8.2.3950
Problem: Going beyond the end of the line with /\%V.
Solution: Check for valid column in getvcol().
Files: src/charset.c, src/testdir/test_regexp_latin.vim


*** ../vim-8.2.3949/src/charset.c 2021-12-15 15:41:41.085254846 +0000
--- src/charset.c 2021-12-30 15:25:49.720736874 +0000
***************
*** 1240,1249 ****
posptr = NULL; // continue until the NUL
else
{
! // Special check for an empty line, which can happen on exit, when
! // ml_get_buf() always returns an empty string.
! if (*ptr == NUL)
! pos->col = 0;
posptr = ptr + pos->col;
if (has_mbyte)
// always start on the first byte
--- 1240,1254 ----
posptr = NULL; // continue until the NUL
else
{
! colnr_T i;
!
! // In a few cases the position can be beyond the end of the line.
! for (i = 0; i < pos->col; ++i)
! if (ptr[i] == NUL)
! {
! pos->col = i;
! break;
! }
posptr = ptr + pos->col;
if (has_mbyte)
// always start on the first byte
*** ../vim-8.2.3949/src/testdir/test_regexp_latin.vim 2021-12-30 14:49:39.953445531 +0000
--- src/testdir/test_regexp_latin.vim 2021-12-30 15:24:33.776867088 +0000
***************
*** 1053,1056 ****
--- 1053,1064 ----
bwipe!
endfunc

+ func Test_using_invalid_visual_position()
+ " this was going beyond the end of the line
+ new
+ exe "norm 0o000\<Esc>0\<C-V>$s0"
+ /\%V
+ bwipe!
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.3949/src/version.c 2021-12-30 14:49:39.953445531 +0000
--- src/version.c 2021-12-30 15:27:37.556529951 +0000
***************
*** 751,752 ****
--- 751,754 ----
{ /* Add new patch number below this line */
+ /**/
+ 3950,
/**/

--
hundred-and-one symptoms of being an internet addict:
155. You forget to eat because you're too busy surfing 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