]> granicus.if.org Git - vim/commitdiff
patch 8.2.4214: illegal memory access with large 'tabstop' in Ex mode v8.2.4214
authorBram Moolenaar <Bram@vim.org>
Tue, 25 Jan 2022 11:55:02 +0000 (11:55 +0000)
committerBram Moolenaar <Bram@vim.org>
Tue, 25 Jan 2022 11:55:02 +0000 (11:55 +0000)
Problem:    Illegal memory access with large 'tabstop' in Ex mode.
Solution:   Allocate enough memory.

src/ex_getln.c
src/testdir/test_ex_mode.vim
src/version.c

index 5dc43d845d0e1b657efd7a4bd6439d86a10fa1df..097b97eeb3e7a3645c252d6eee32adb5b00ec364 100644 (file)
@@ -1513,7 +1513,7 @@ init_ccline(int firstc, int indent)
     ccline.cmdindent = (firstc > 0 ? indent : 0);
 
     // alloc initial ccline.cmdbuff
-    alloc_cmdbuff(exmode_active ? 250 : indent + 1);
+    alloc_cmdbuff(indent + 50);
     if (ccline.cmdbuff == NULL)
        return FAIL;
     ccline.cmdlen = ccline.cmdpos = 0;
index 7031115fcba5a8dbe0f51b837f7df08adee78844..2642a16d257624a97d022150909334fa393931f3 100644 (file)
@@ -241,4 +241,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
index 2846ea949595b7cd8c5170daa53707dabe173f83..5d7eccb19109b0b2222e42894e37b117479da698 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4214,
 /**/
     4213,
 /**/