vim/backport-invalid-memory-access-with-search-command.patch
renmingshuai 594c93ac93 add make check
(cherry picked from commit 48262f55f74fda64130fa65b86e6db86f5f0e929)
2022-02-18 15:23:59 +08:00

45 lines
1.6 KiB
Diff

From 98a336dd497d3422e7efeef9f24cc9e25aeb8a49 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Mon, 20 Jan 2020 20:22:30 +0100
Subject: [PATCH] patch 8.2.0133: invalid memory access with search command
Problem: Invalid memory access with search command.
Solution: When :normal runs out of characters in bracketed paste mode break
out of the loop.(closes #5511)
Reference:https://github.com/vim/vim/commit/98a336dd497d3422e7efeef9f24cc9e25aeb8a49
Conflict:The src/version.c file is not modified.
---
src/edit.c | 4 ++--
src/testdir/test_search.vim | 5 +++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/edit.c b/src/edit.c
index d2e45dd..f822a79 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -4959,9 +4959,9 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
do
c = vgetc();
while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR);
- if (c == NUL || got_int)
+ if (c == NUL || got_int || (ex_normal_busy > 0 && c == Ctrl_C))
// When CTRL-C was encountered the typeahead will be flushed and we
- // won't get the end sequence.
+ // won't get the end sequence. Except when using ":normal".
break;
if (has_mbyte)
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index 1876713..c8020eb 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -1366,3 +1366,8 @@ func Test_searchdecl()
bwipe!
endfunc
+
+func Test_search_special()
+ " this was causing illegal memory access
+ exe "norm /\x80PS"
+endfunc
--
2.27.0