diff src/testdir/test_substitute.vim @ 28909:1890fa76a634 v8.2.4977

patch 8.2.4977: memory access error when substitute expression changes window Commit: https://github.com/vim/vim/commit/e2bd8600b873d2cd1f9d667c28cba8b1dba18839 Author: Bram Moolenaar <Bram@vim.org> Date: Wed May 18 13:11:57 2022 +0100 patch 8.2.4977: memory access error when substitute expression changes window Problem: Memory access error when substitute expression changes window. Solution: Disallow changing window in substitute expression.
author Bram Moolenaar <Bram@vim.org>
date Wed, 18 May 2022 14:15:02 +0200
parents 553ff405b719
children 48d74a5822eb
line wrap: on
line diff
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -1000,6 +1000,19 @@ func Test_using_old_sub()
   set nocompatible
 endfunc
 
+" This was switching windows in between computing the length and using it.
+func Test_sub_change_window()
+  silent! lfile
+  sil! norm o0000000000000000000000000000000000000000000000000000
+  func Repl()
+    lopen
+  endfunc
+  silent!  s/\%')/\=Repl()
+  bwipe!
+  bwipe!
+  delfunc Repl
+endfunc
+
 " Test for the 2-letter and 3-letter :substitute commands
 func Test_substitute_short_cmd()
   new