Blame SOURCES/0001-patch-8.2.4214-illegal-memory-access-with-large-tabs.patch

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