44 lines
1.3 KiB
Diff
44 lines
1.3 KiB
Diff
From fe4bbac1166f2e4e3fa18cb966ec7305198c8176 Mon Sep 17 00:00:00 2001
|
|
From: Bram Moolenaar <Bram@vim.org>
|
|
Date: Mon, 20 Jan 2020 21:12:20 +0100
|
|
Subject: [PATCH] patch 8.2.0135: bracketed paste can still cause invalid
|
|
memory access
|
|
|
|
Problem: Bracketed paste can still cause invalid memory access. (Dominique
|
|
Pelle)
|
|
Solution: Check for NULL pointer.
|
|
---
|
|
src/edit.c | 2 +-
|
|
src/testdir/test_search.vim | 3 ++-
|
|
2 files changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/edit.c b/src/edit.c
|
|
index a1836c9..15b0cc9 100644
|
|
--- a/src/edit.c
|
|
+++ b/src/edit.c
|
|
@@ -4930,7 +4930,7 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
|
|
int save_paste = p_paste;
|
|
|
|
// If the end code is too long we can't detect it, read everything.
|
|
- if (STRLEN(end) >= NUMBUFLEN)
|
|
+ if (end != NULL && STRLEN(end) >= NUMBUFLEN)
|
|
end = NULL;
|
|
++no_mapping;
|
|
allow_keys = 0;
|
|
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
|
|
index e74681f..7e86b79 100644
|
|
--- a/src/testdir/test_search.vim
|
|
+++ b/src/testdir/test_search.vim
|
|
@@ -1382,6 +1382,7 @@ func Test_search_with_invalid_range()
|
|
endfunc
|
|
|
|
func Test_search_special()
|
|
- " this was causing illegal memory access
|
|
+ " this was causing illegal memory access and an endless loop
|
|
+ set t_PE=
|
|
exe "norm /\x80PS"
|
|
endfunc
|
|
--
|
|
2.33.0
|
|
|