|
|
13ea7f |
From 85b6747abc15a7a81086db31289cf1b8b17e6cb1 Mon Sep 17 00:00:00 2001
|
|
|
13ea7f |
From: Bram Moolenaar <Bram@vim.org>
|
|
|
13ea7f |
Date: Tue, 25 Jan 2022 11:55:02 +0000
|
|
|
13ea7f |
Subject: [PATCH] patch 8.2.4214: illegal memory access with large 'tabstop' in
|
|
|
13ea7f |
Ex mode
|
|
|
13ea7f |
|
|
|
13ea7f |
Problem: Illegal memory access with large 'tabstop' in Ex mode.
|
|
|
13ea7f |
Solution: Allocate enough memory.
|
|
|
13ea7f |
---
|
|
|
13ea7f |
src/ex_getln.c | 2 +-
|
|
|
13ea7f |
src/testdir/test_ex_mode.vim | 10 ++++++++++
|
|
|
13ea7f |
src/version.c | 2 ++
|
|
|
13ea7f |
3 files changed, 13 insertions(+), 1 deletion(-)
|
|
|
13ea7f |
|
|
|
13ea7f |
diff --git a/src/ex_getln.c b/src/ex_getln.c
|
|
|
13ea7f |
index 5dc43d845..097b97eeb 100644
|
|
|
13ea7f |
--- a/src/ex_getln.c
|
|
|
13ea7f |
+++ b/src/ex_getln.c
|
|
|
13ea7f |
@@ -1513,7 +1513,7 @@ init_ccline(int firstc, int indent)
|
|
|
13ea7f |
ccline.cmdindent = (firstc > 0 ? indent : 0);
|
|
|
13ea7f |
|
|
|
13ea7f |
// alloc initial ccline.cmdbuff
|
|
|
13ea7f |
- alloc_cmdbuff(exmode_active ? 250 : indent + 1);
|
|
|
13ea7f |
+ alloc_cmdbuff(indent + 50);
|
|
|
13ea7f |
if (ccline.cmdbuff == NULL)
|
|
|
13ea7f |
return FAIL;
|
|
|
13ea7f |
ccline.cmdlen = ccline.cmdpos = 0;
|
|
|
13ea7f |
diff --git a/src/testdir/test_ex_mode.vim b/src/testdir/test_ex_mode.vim
|
|
|
13ea7f |
index 7031115fc..2642a16d2 100644
|
|
|
13ea7f |
--- a/src/testdir/test_ex_mode.vim
|
|
|
13ea7f |
+++ b/src/testdir/test_ex_mode.vim
|
|
|
13ea7f |
@@ -241,4 +241,14 @@ func Test_ex_mode_count_overflow()
|
|
|
13ea7f |
call delete('Xexmodescript')
|
|
|
13ea7f |
endfunc
|
|
|
13ea7f |
|
|
|
13ea7f |
+func Test_ex_mode_large_indent()
|
|
|
13ea7f |
+ new
|
|
|
13ea7f |
+ set ts=500 ai
|
|
|
13ea7f |
+ call setline(1, "\t")
|
|
|
13ea7f |
+ exe "normal gQi\<CR>."
|
|
|
13ea7f |
+ set ts=8 noai
|
|
|
13ea7f |
+ bwipe!
|
|
|
13ea7f |
+endfunc
|
|
|
13ea7f |
+
|
|
|
13ea7f |
+
|
|
|
13ea7f |
" vim: shiftwidth=2 sts=2 expandtab
|
|
|
13ea7f |
--
|
|
|
13ea7f |
2.34.1
|
|
|
13ea7f |
|