summaryrefslogtreecommitdiffstats
path: root/debian/patches/CVE-2022-1619.patch
blob: 1015395a21e6980fea05c08415a374a3ad9de4f4 (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
From ef02f16609ff0a26ffc6e20263523424980898fe Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sat, 7 May 2022 10:49:10 +0100
Subject: [PATCH] patch 8.2.4899: with latin1 encoding CTRL-W might go before
 the cmdline

Problem:    With latin1 encoding CTRL-W might go before the start of the
            command line.
Solution:   Check already being at the start of the command line.
---
 src/ex_getln.c               | 11 +++++++----
 src/testdir/test_cmdline.vim |  3 +++
 src/version.c                |  2 ++
 3 files changed, 12 insertions(+), 4 deletions(-)

--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -1635,10 +1635,13 @@ getcmdline_int(
 		    {
 			while (p > ccline.cmdbuff && vim_isspace(p[-1]))
 			    --p;
-			i = vim_iswordc(p[-1]);
-			while (p > ccline.cmdbuff && !vim_isspace(p[-1])
-				&& vim_iswordc(p[-1]) == i)
-			    --p;
+			if (p > ccline.cmdbuff)
+			{
+			    i = vim_iswordc(p[-1]);
+			    while (p > ccline.cmdbuff && !vim_isspace(p[-1])
+				    && vim_iswordc(p[-1]) == i)
+				--p;
+			}
 		    }
 		    else
 			--p;
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -642,5 +642,18 @@ func Test_cmdwin_split_often()
   let &columns = columns
 endfunc
 
+func Test_cmdline_remove_char()
+  let encoding_save = &encoding
+
+  for e in ['utf8', 'latin1']
+    exe 'set encoding=' . e
+
+    " This was going before the start in latin1.
+    call feedkeys(": \<C-W>\<CR>", 'tx')
+  endfor
+
+  let &encoding = encoding_save
+endfunc
+
 
 set cpo&
--- a/src/version.c
+++ b/src/version.c
@@ -796,6 +796,8 @@ static int included_patches[] =
 /**/
     5024,
 /**/
+    4899,
+/**/
     4428,
 /**/
     4397,