aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-03-08 11:17:49 +0800
committerGitHub <noreply@github.com>2023-03-08 11:17:49 +0800
commit06aed7c1776e9db769c77ce836c1995128a6afc6 (patch)
treed51b8974e63caf7dd4d4d1b4511ea294df6eeddf
parent0e7edd70a95d962dfbe5b52c2767887a7131e0a0 (diff)
downloadrneovim-06aed7c1776e9db769c77ce836c1995128a6afc6.tar.gz
rneovim-06aed7c1776e9db769c77ce836c1995128a6afc6.tar.bz2
rneovim-06aed7c1776e9db769c77ce836c1995128a6afc6.zip
vim-patch:8.2.3741: using freed memory in open command (#22568)
Problem: Using freed memory in open command. Solution: Make a copy of the current line. https://github.com/vim/vim/commit/e031fe90cf2e375ce861ff5e5e281e4ad229ebb9 Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r--test/old/testdir/test_ex_mode.vim14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/old/testdir/test_ex_mode.vim b/test/old/testdir/test_ex_mode.vim
index 93100732ed..a6201886aa 100644
--- a/test/old/testdir/test_ex_mode.vim
+++ b/test/old/testdir/test_ex_mode.vim
@@ -123,6 +123,20 @@ func Test_open_command()
close!
endfunc
+func Test_open_command_flush_line()
+ throw 'Skipped: Nvim does not have :open'
+ " this was accessing freed memory: the regexp match uses a pointer to the
+ " current line which becomes invalid when searching for the ') mark.
+ new
+ call setline(1, ['one', 'two. three'])
+ s/one/ONE
+ try
+ open /\%')/
+ catch /E479/
+ endtry
+ bwipe!
+endfunc
+
" Test for :g/pat/visual to run vi commands in Ex mode
" This used to hang Vim before 8.2.0274.
func Test_Ex_global()