mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 9.0.0025: accessing beyond allocated memory with the cmdline window
Problem: Accessing beyond allocated memory when using the cmdline window in Ex mode. Solution: Use "*" instead of "'<,'>" for Visual mode.
This commit is contained in:
@@ -3118,9 +3118,11 @@ parse_command_modifiers(
|
|||||||
size_t len = STRLEN(cmd_start);
|
size_t len = STRLEN(cmd_start);
|
||||||
|
|
||||||
// Special case: empty command uses "+":
|
// Special case: empty command uses "+":
|
||||||
// "'<,'>mods" -> "mods'<,'>+
|
// "'<,'>mods" -> "mods *+
|
||||||
|
// Use "*" instead of "'<,'>" to avoid the command getting
|
||||||
|
// longer, in case is was allocated.
|
||||||
mch_memmove(orig_cmd, cmd_start, len);
|
mch_memmove(orig_cmd, cmd_start, len);
|
||||||
STRCPY(orig_cmd + len, "'<,'>+");
|
STRCPY(orig_cmd + len, " *+");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -2103,6 +2103,14 @@ func Test_cmdwin_insert_mode_close()
|
|||||||
call assert_equal(1, winnr('$'))
|
call assert_equal(1, winnr('$'))
|
||||||
endfunc
|
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
|
" test that ";" works to find a match at the start of the first line
|
||||||
func Test_zero_line_search()
|
func Test_zero_line_search()
|
||||||
new
|
new
|
||||||
|
@@ -735,6 +735,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
25,
|
||||||
/**/
|
/**/
|
||||||
24,
|
24,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user