summaryrefslogtreecommitdiffstats
path: root/debian/patches/CVE-2022-0729.patch
blob: 79c810a0522c4d57da6e6d2d873e09e5e038137b (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
From: Markus Koschany <apo@debian.org>
Date: Sun, 30 Oct 2022 22:10:14 +0100
Subject: CVE-2022-0729

Origin: https://github.com/vim/vim/commit/6456fae9ba8e72c74b2c0c499eaf09974604ff30
---
 src/regexp.c                     | 5 +++++
 src/testdir/test_regexp_utf8.vim | 8 ++++++++
 2 files changed, 13 insertions(+)

--- a/src/regexp.c
+++ b/src/regexp.c
@@ -5575,6 +5575,11 @@ regmatch(
 			    if (rex.input == rex.line)
 			    {
 				/* backup to last char of previous line */
+				if (rex.lnum == 0)
+				{
+				    status = RA_NOMATCH;
+				    break;
+				}
 				--rex.lnum;
 				rex.line = reg_getline(rex.lnum);
 				/* Just in case regrepeat() didn't count
--- a/src/testdir/test_regexp_utf8.vim
+++ b/src/testdir/test_regexp_utf8.vim
@@ -215,4 +215,12 @@ func Test_match_invalid_byte()
   call delete('Xinvalid')
 endfunc
 
+func Test_match_too_complicated()
+  set regexpengine=1
+  exe "vsplit \xeb\xdb\x99"
+  silent! buf \&\zs*\zs*0
+  bwipe!
+  set regexpengine=0
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab