Patch 9.0.0025
Problem: Accessing beyond allocated memory when using the cmdline window in
Ex mode.
Solution: Use "*" instead of "'<,'>" for Visual mode.
Files: src/ex_docmd.c, src/testdir/test_cmdline.vim
*** ../vim-9.0.0024/src/ex_docmd.c 2022-06-22 19:04:37.000000000 +0100
--- src/ex_docmd.c 2022-07-02 13:40:40.199988698 +0100
***************
*** 3118,3126 ****
size_t len = STRLEN(cmd_start);
// Special case: empty command uses "+":
! // "'<,'>mods" -> "mods'<,'>+
mch_memmove(orig_cmd, cmd_start, len);
! STRCPY(orig_cmd + len, "'<,'>+");
}
else
{
--- 3118,3128 ----
size_t len = STRLEN(cmd_start);
// Special case: empty command uses "+":
! // "'<,'>mods" -> "mods *+
! // Use "*" instead of "'<,'>" to avoid the command getting
! // longer, in case is was allocated.
mch_memmove(orig_cmd, cmd_start, len);
! STRCPY(orig_cmd + len, " *+");
}
else
{
*** ../vim-9.0.0024/src/testdir/test_cmdline.vim 2022-06-22 19:02:12.000000000 +0100
--- src/testdir/test_cmdline.vim 2022-07-02 13:39:41.468080762 +0100
***************
*** 2103,2108 ****
--- 2103,2116 ----
call assert_equal(1, winnr('$'))
endfunc
+ func Test_cmdwin_ex_mode_with_modifier()
+ " this was accessing memory after allocated text in Ex mode
+ new
+ call setline(1, ['some', 'text', 'lines'])
+ silent! call feedkeys("gQnormal vq:atopleft\<C-V>\<CR>\<CR>", 'xt')
+ bwipe!
+ endfunc
+
" test that ";" works to find a match at the start of the first line
func Test_zero_line_search()
new
*** ../vim-9.0.0024/src/version.c 2022-07-02 12:08:12.813935667 +0100
--- src/version.c 2022-07-02 13:42:56.683779047 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 25,
/**/
--
A day without sunshine is like, well, night.
/// 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 ///