summaryrefslogtreecommitdiffstats
path: root/debian/patches/CVE-2022-0696.patch
blob: 0e1491edeae3a8686cf19f655d29a61fd8983e47 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
From 0f6e28f686dbb59ab3b562408ab9b2234797b9b1 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sun, 20 Feb 2022 20:49:35 +0000
Subject: [PATCH] patch 8.2.4428: crash when switching tabpage while in the
 cmdline window

Problem:    Crash when switching tabpage while in the cmdline window.
Solution:   Disallow switching tabpage when in the cmdline window.
---
 src/evalvars.c       | 14 ++------------
 src/proto/window.pro |  1 +
 src/usercmd.c        | 24 ++++--------------------
 src/version.c        |  2 ++
 src/window.c         | 26 ++++++++++++++++++++++++++
 5 files changed, 35 insertions(+), 32 deletions(-)

Backport: Since the old version dosn't do command line completion
correctly, those parts are dropped and we only forbid switching the tab
page.

diff --git a/src/version.c b/src/version.c
index c5f5c22f90ac..777476d80dce 100644
--- a/src/version.c
+++ b/src/version.c
@@ -795,6 +795,8 @@ static char *(features[]) =
     805,
 /**/
     5024,
+/**/
+    4428,
 /**/
     4397,
 /**/
diff --git a/src/window.c b/src/window.c
index 1f5e7096047c..b00ed977fc04 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3656,6 +3656,14 @@ win_new_tabpage(int after)
     tabpage_T	*newtp;
     int		n;
 
+#ifdef FEAT_CMDWIN
+    if (cmdwin_type != 0)
+    {
+	emsg(_("E11: Invalid in command-line window; :q<CR> closes the window"));
+	return FAIL;
+    }
+#endif
+
     newtp = alloc_tabpage();
     if (newtp == NULL)
 	return FAIL;
@@ -3997,6 +4005,7 @@ goto_tabpage(int n)
 	text_locked_msg();
 	return;
     }
+    CHECK_CMDWIN;
 
     /* If there is only one it can't work. */
     if (first_tabpage->tp_next == NULL)
@@ -4064,6 +4073,8 @@ goto_tabpage_tp(
     int		trigger_enter_autocmds,
     int		trigger_leave_autocmds)
 {
+    CHECK_CMDWIN;
+
     /* Don't repeat a message in another tab page. */
     set_keep_msg(NULL, 0);