summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libvterm/src/parser.c2
-rw-r--r--src/testdir/test_terminal3.vim11
-rw-r--r--src/version.c2
3 files changed, 15 insertions, 0 deletions
diff --git a/src/libvterm/src/parser.c b/src/libvterm/src/parser.c
index 6d225166e3..b060e2b8ad 100644
--- a/src/libvterm/src/parser.c
+++ b/src/libvterm/src/parser.c
@@ -241,6 +241,8 @@ size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len)
c = ';';
}
if(c == ';') {
+ if(vt->parser.v.csi.argi >= CSI_ARGS_MAX - 1)
+ break; /* drop excess args */
vt->parser.v.csi.argi++;
vt->parser.v.csi.args[vt->parser.v.csi.argi] = CSI_ARG_MISSING;
break;
diff --git a/src/testdir/test_terminal3.vim b/src/testdir/test_terminal3.vim
index 263b5f3093..cdfa189068 100644
--- a/src/testdir/test_terminal3.vim
+++ b/src/testdir/test_terminal3.vim
@@ -1229,4 +1229,15 @@ func Test_term_autowrite()
set noautowrite
endfunc
+" Test that CSI sequences with more than CSI_ARGS_MAX arguments do not crash
+func Test_terminal_csi_args_overflow()
+ CheckExecutable printf
+ let buf = term_start([&shell, &shellcmdflag,
+ \ 'printf "\033[' . repeat('1;', 49) . '1m"'])
+
+ " If we get here without a crash, the fix works
+ call assert_equal('running', term_getstatus(buf))
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 009c332761..43fee673fb 100644
--- a/src/version.c
+++ b/src/version.c
@@ -735,6 +735,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 279,
+/**/
278,
/**/
277,