summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/vim/files/0005-patch-8.2.3564-invalid-memory-access-when-scrolling-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/vim/files/0005-patch-8.2.3564-invalid-memory-access-when-scrolling-.patch')
-rw-r--r--meta/recipes-support/vim/files/0005-patch-8.2.3564-invalid-memory-access-when-scrolling-.patch97
1 files changed, 97 insertions, 0 deletions
diff --git a/meta/recipes-support/vim/files/0005-patch-8.2.3564-invalid-memory-access-when-scrolling-.patch b/meta/recipes-support/vim/files/0005-patch-8.2.3564-invalid-memory-access-when-scrolling-.patch
new file mode 100644
index 0000000000..7184b37cad
--- /dev/null
+++ b/meta/recipes-support/vim/files/0005-patch-8.2.3564-invalid-memory-access-when-scrolling-.patch
@@ -0,0 +1,97 @@
1CVE: CVE-2021-3903
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From b15919c1fe0f7fc3d98ff5207ed2feb43c59009d Mon Sep 17 00:00:00 2001
6From: Bram Moolenaar <Bram@vim.org>
7Date: Mon, 25 Oct 2021 17:07:04 +0100
8Subject: [PATCH] patch 8.2.3564: invalid memory access when scrolling without
9 valid screen
10
11Problem: Invalid memory access when scrolling without a valid screen.
12Solution: Do not set VALID_BOTLINE in w_valid.
13---
14 src/move.c | 1 -
15 src/testdir/test_normal.vim | 23 ++++++++++++++++++++---
16 src/version.c | 2 ++
17 3 files changed, 22 insertions(+), 4 deletions(-)
18
19diff --git a/src/move.c b/src/move.c
20index 8e53d8bcb..10165ef4d 100644
21--- a/src/move.c
22+++ b/src/move.c
23@@ -198,7 +198,6 @@ update_topline(void)
24 {
25 curwin->w_topline = curwin->w_cursor.lnum;
26 curwin->w_botline = curwin->w_topline;
27- curwin->w_valid |= VALID_BOTLINE|VALID_BOTLINE_AP;
28 curwin->w_scbind_pos = 1;
29 return;
30 }
31diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
32index d45cf4159..ca87928f5 100644
33--- a/src/testdir/test_normal.vim
34+++ b/src/testdir/test_normal.vim
35@@ -33,14 +33,14 @@ func CountSpaces(type, ...)
36 else
37 silent exe "normal! `[v`]y"
38 endif
39- let g:a=strlen(substitute(@@, '[^ ]', '', 'g'))
40+ let g:a = strlen(substitute(@@, '[^ ]', '', 'g'))
41 let &selection = sel_save
42 let @@ = reg_save
43 endfunc
44
45 func OpfuncDummy(type, ...)
46 " for testing operatorfunc
47- let g:opt=&linebreak
48+ let g:opt = &linebreak
49
50 if a:0 " Invoked from Visual mode, use gv command.
51 silent exe "normal! gvy"
52@@ -51,7 +51,7 @@ func OpfuncDummy(type, ...)
53 endif
54 " Create a new dummy window
55 new
56- let g:bufnr=bufnr('%')
57+ let g:bufnr = bufnr('%')
58 endfunc
59
60 fun! Test_normal00_optrans()
61@@ -718,6 +718,23 @@ func Test_normal17_z_scroll_hor2()
62 bw!
63 endfunc
64
65+
66+func Test_scroll_in_ex_mode()
67+ " This was using invalid memory because w_botline was invalid.
68+ let lines =<< trim END
69+ diffsplit
70+ norm os00(
71+ call writefile(['done'], 'Xdone')
72+ qa!
73+ END
74+ call writefile(lines, 'Xscript')
75+ call assert_equal(1, RunVim([], [], '--clean -X -Z -e -s -S Xscript'))
76+ call assert_equal(['done'], readfile('Xdone'))
77+
78+ call delete('Xscript')
79+ call delete('Xdone')
80+endfunc
81+
82 func Test_normal18_z_fold()
83 " basic tests for foldopen/folddelete
84 if !has("folding")
85diff --git a/src/version.c b/src/version.c
86index 092864bbb..a9e8be0e7 100644
87--- a/src/version.c
88+++ b/src/version.c
89@@ -742,6 +742,8 @@ static char *(features[]) =
90
91 static int included_patches[] =
92 { /* Add new patch number below this line */
93+/**/
94+ 3564,
95 /**/
96 3489,
97 /**/