summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-12-19 12:27:23 +0100
committerBram Moolenaar <Bram@vim.org>2017-12-19 12:27:23 +0100
commit2efb323e875d2852f63e41c40641760d1d6b069f (patch)
treeb45519644d8316b0f2312dce30d73cc60de79838
parent338e47fdfdf0d918dae50a5cbf0cf4f7be45b4f0 (diff)
patch 8.0.1411: reading invalid memory with CTRL-W :v8.0.1411
Problem: Reading invalid memory with CTRL-W :. Solution: Correct the command characters. (closes #2469)
-rw-r--r--src/normal.c4
-rw-r--r--src/ops.c7
-rw-r--r--src/testdir/test_window_cmd.vim5
-rw-r--r--src/version.c2
4 files changed, 18 insertions, 0 deletions
diff --git a/src/normal.c b/src/normal.c
index 76eb18a21f..a8e65ffd62 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -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 */
}
diff --git a/src/ops.c b/src/ops.c
index cfa0bb367e..83c36bda67 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -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;
}
diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim
index 067f09cbc3..925cfcc484 100644
--- a/src/testdir/test_window_cmd.vim
+++ b/src/testdir/test_window_cmd.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index cf53357a71..ec17e4e672 100644
--- a/src/version.c
+++ b/src/version.c
@@ -772,6 +772,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1411,
+/**/
1410,
/**/
1409,