vim/backport-patch-8.2.0133-invalid-memory-access-with-search-com.patch
2022-09-06 17:18:05 +08:00

46 lines
1.5 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)
---
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 a20fd3d..a1836c9 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -4947,9 +4947,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 ac0881c..e74681f 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -1380,3 +1380,8 @@ func Test_search_with_invalid_range()
bwipe!
call delete('Xrangesearch')
endfunc
+
+func Test_search_special()
+ " this was causing illegal memory access
+ exe "norm /\x80PS"
+endfunc
--
2.33.0