0
0
mirror of https://github.com/vim/vim.git synced 2025-07-04 23:07:33 -04:00

patch 8.0.1411: reading invalid memory with CTRL-W :

Problem:    Reading invalid memory with CTRL-W :.
Solution:   Correct the command characters. (closes #2469)
This commit is contained in:
Bram Moolenaar 2017-12-19 12:27:23 +01:00
parent 338e47fdfd
commit 2efb323e87
4 changed files with 18 additions and 0 deletions

View File

@ -7850,8 +7850,12 @@ n_start_visual_mode(int c)
nv_window(cmdarg_T *cap)
{
if (cap->nchar == ':')
{
/* "CTRL-W :" is the same as typing ":"; useful in a terminal window */
cap->cmdchar = ':';
cap->nchar = NUL;
nv_colon(cap);
}
else if (!checkclearop(cap->oap))
do_window(cap->nchar, cap->count0, NUL); /* everything is in window.c */
}

View File

@ -183,8 +183,15 @@ get_op_type(int char1, int char2)
if (char1 == 'g' && char2 == Ctrl_X) /* subtract */
return OP_NR_SUB;
for (i = 0; ; ++i)
{
if (opchars[i][0] == char1 && opchars[i][1] == char2)
break;
if (i == (int)(sizeof(opchars) / sizeof(char [3]) - 1))
{
internal_error("get_op_type()");
break;
}
}
return i;
}

View File

@ -467,4 +467,9 @@ func Test_window_contents()
call test_garbagecollect_now()
endfunc
func Test_window_colon_command()
" This was reading invalid memory.
exe "norm! v\<C-W>:\<C-U>echo v:version"
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@ -771,6 +771,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1411,
/**/
1410,
/**/