summaryrefslogtreecommitdiffstats
path: root/debian/patches/CVE-2022-0319.patch
blob: 680eddc5b80efb837dac1ffee8fa2c695d98afe0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From: Markus Koschany <apo@debian.org>
Date: Sun, 23 Oct 2022 17:11:51 +0200
Subject: CVE-2022-0319

Origin: https://github.com/vim/vim/commit/05b27615481e72e3b338bb12990fb3e0c2ecc2a9
---
 src/testdir/test_visual.vim | 10 ++++++++++
 src/window.c                |  5 +++++
 2 files changed, 15 insertions(+)

--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -3,6 +3,16 @@ if !has('visual')
   finish
 endif
 
+" this was causing an ml_get error
+func Test_visual_exchange_windows()
+  enew!
+  new
+  call setline(1, ['foo', 'bar'])
+  exe "normal G\<C-V>gg\<C-W>\<C-X>OO\<Esc>"
+  bwipe!
+  bwipe!
+endfunc
+
 
 func Test_block_shift_multibyte()
   " Uses double-wide character.
--- a/src/window.c
+++ b/src/window.c
@@ -1576,6 +1576,11 @@ win_exchange(long Prenum)
 
     (void)win_comp_pos();		/* recompute window positions */
 
+    if (wp->w_buffer != curbuf)
+	reset_VIsual_and_resel();
+    else if (VIsual_active)
+	wp->w_cursor = curwin->w_cursor;
+
     win_enter(wp, TRUE);
     redraw_all_later(NOT_VALID);
 }