]> granicus.if.org Git - vim/commitdiff
patch 8.2.3564: invalid memory access when scrolling without valid screen v8.2.3564
authorBram Moolenaar <Bram@vim.org>
Mon, 25 Oct 2021 16:07:04 +0000 (17:07 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 25 Oct 2021 16:07:04 +0000 (17:07 +0100)
Problem:    Invalid memory access when scrolling without a valid screen.
Solution:   Do not set VALID_BOTLINE in w_valid.

src/move.c
src/testdir/test_normal.vim
src/version.c

index 8fe00bb678d39550918afdb2065c6c32892fb1e8..64b12963c6b94ee7d6f346be5957a41f3877e311 100644 (file)
@@ -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;
     }
index f8dbf8aeda0836771d5b20555c4d81df9a1f1fb1..f994f970ab7d363b9f576aa177bd6738a50b17be 100644 (file)
@@ -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 os0\ 30(\ 4
+      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
index 57585dc5deaef8be70ad48dfa19954289c386a7d..2c25238a0d8967886957c7dbb8db43879a848617 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3564,
 /**/
     3563,
 /**/