Patch 9.0.0025

14 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 2, 2022, 8:44:06 AM7/2/22
to vim...@googlegroups.com

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 ///

John Marriott

unread,
Jul 2, 2022, 11:06:39 PM7/2/22
to vim...@googlegroups.com

On 02-July-2022 22:43, Bram Moolenaar wrote:
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
  
  		// 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);

In ex_docmd.c:
:3123 s/in case is was allocated/in case it was allocated

Cheers
John

Bram Moolenaar

unread,
Jul 3, 2022, 8:16:53 AM7/3/22
to vim...@googlegroups.com, John Marriott
> :3123 s/in case*is *was allocated/in case*it *was allocated

Thanks.

--
Despite the cost of living, have you noticed how it remains so popular?
Reply all
Reply to author
Forward
0 new messages