Skip to content

Commit

Permalink
patch 8.2.4214: illegal memory access with large 'tabstop' in Ex mode
Browse files Browse the repository at this point in the history
Problem:    Illegal memory access with large 'tabstop' in Ex mode.
Solution:   Allocate enough memory.
  • Loading branch information
brammool committed Jan 25, 2022
1 parent 76687d2 commit 85b6747
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ex_getln.c
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions src/testdir/test_ex_mode.vim
Expand Up @@ -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
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -750,6 +750,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4214,
/**/
4213,
/**/
Expand Down

0 comments on commit 85b6747

Please sign in to comment.