summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-10-25 17:07:04 +0100
committerBram Moolenaar <Bram@vim.org>2021-10-25 17:07:04 +0100
commit777e7c21b7627be80961848ac560cb0a9978ff43 (patch)
tree526865f1b3d36f8f40646c203196d57a3acc917f
parent2a52196b78f3fcc0e9fad538984272c5fd8d85db (diff)
downloadvim-git-777e7c21b7627be80961848ac560cb0a9978ff43.tar.gz
patch 8.2.3564: invalid memory access when scrolling without valid screenv8.2.3564
Problem: Invalid memory access when scrolling without a valid screen. Solution: Do not set VALID_BOTLINE in w_valid.
-rw-r--r--src/move.c1
-rw-r--r--src/testdir/test_normal.vim22
-rw-r--r--src/version.c2
3 files changed, 21 insertions, 4 deletions
diff --git a/src/move.c b/src/move.c
index 8fe00bb67..64b12963c 100644
--- a/src/move.c
+++ b/src/move.c
@@ -199,7 +199,6 @@ update_topline(void)
check_cursor_lnum();
curwin->w_topline = curwin->w_cursor.lnum;
curwin->w_botline = curwin->w_topline;
- curwin->w_valid |= VALID_BOTLINE|VALID_BOTLINE_AP;
curwin->w_scbind_pos = 1;
return;
}
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index f8dbf8aed..f994f970a 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -34,14 +34,14 @@ func CountSpaces(type, ...)
else
silent exe "normal! `[v`]y"
endif
- let g:a=strlen(substitute(@@, '[^ ]', '', 'g'))
+ let g:a = strlen(substitute(@@, '[^ ]', '', 'g'))
let &selection = sel_save
let @@ = reg_save
endfunc
func OpfuncDummy(type, ...)
" for testing operatorfunc
- let g:opt=&linebreak
+ let g:opt = &linebreak
if a:0 " Invoked from Visual mode, use gv command.
silent exe "normal! gvy"
@@ -52,7 +52,7 @@ func OpfuncDummy(type, ...)
endif
" Create a new dummy window
new
- let g:bufnr=bufnr('%')
+ let g:bufnr = bufnr('%')
endfunc
func Test_normal00_optrans()
@@ -987,6 +987,22 @@ func Test_vert_scroll_cmds()
close!
endfunc
+func Test_scroll_in_ex_mode()
+ " This was using invalid memory because w_botline was invalid.
+ let lines =<< trim END
+ diffsplit
+ norm os00(
+ call writefile(['done'], 'Xdone')
+ qa!
+ END
+ call writefile(lines, 'Xscript')
+ call assert_equal(1, RunVim([], [], '--clean -X -Z -e -s -S Xscript'))
+ call assert_equal(['done'], readfile('Xdone'))
+
+ call delete('Xscript')
+ call delete('Xdone')
+endfunc
+
" Test for the 'sidescroll' option
func Test_sidescroll_opt()
new
diff --git a/src/version.c b/src/version.c
index 57585dc5d..2c25238a0 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3564,
+/**/
3563,
/**/
3562,