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.

e031fe90cf

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq 2023-03-08 11:17:49 +08:00 committed by GitHub
parent 0e7edd70a9
commit 06aed7c177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()