aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2022-01-26 16:36:05 +0100
committerChristian Clason <c.clason@uni-graz.at>2022-01-26 21:34:26 +0100
commitde673966c3b681e8354a26a1f054fbda6e07294a (patch)
treed0b66941a1966891d970a2fe16d903b76195ea72
parent17e2938b100070d91bd956c8734760ca16f6d3f2 (diff)
downloadrneovim-de673966c3b681e8354a26a1f054fbda6e07294a.tar.gz
rneovim-de673966c3b681e8354a26a1f054fbda6e07294a.tar.bz2
rneovim-de673966c3b681e8354a26a1f054fbda6e07294a.zip
vim-patch:8.2.4214: illegal memory access with large 'tabstop' in Ex mode
Problem: Illegal memory access with large 'tabstop' in Ex mode. Solution: Allocate enough memory. https://github.com/vim/vim/commit/85b6747abc15a7a81086db31289cf1b8b17e6cb1
-rw-r--r--src/nvim/ex_getln.c2
-rw-r--r--src/nvim/testdir/test_ex_mode.vim10
2 files changed, 11 insertions, 1 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 78b8e43e65..fd75cfc7f8 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -772,7 +772,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent)
ccline.cmdindent = (s->firstc > 0 ? s->indent : 0);
// alloc initial ccline.cmdbuff
- alloc_cmdbuff(exmode_active ? 250 : s->indent + 1);
+ alloc_cmdbuff(indent + 50);
ccline.cmdlen = ccline.cmdpos = 0;
ccline.cmdbuff[0] = NUL;
diff --git a/src/nvim/testdir/test_ex_mode.vim b/src/nvim/testdir/test_ex_mode.vim
index 92e0559618..78663f7deb 100644
--- a/src/nvim/testdir/test_ex_mode.vim
+++ b/src/nvim/testdir/test_ex_mode.vim
@@ -98,4 +98,14 @@ func Test_ex_mode_count_overflow()
call delete('Xexmodescript')
endfunc
+func Test_ex_mode_large_indent()
+ new
+ set ts=500 ai
+ call setline(1, "\t")
+ exe "normal gQi\<CR>."
+ set ts=8 noai
+ bwipe!
+endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab