To: vim_dev@googlegroups.com Subject: Patch 8.2.3950 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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\0\$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 -- Bram@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 ///