forked from aniani/vim
patch 9.1.0678: [security]: use-after-free in alist_add()
Problem: [security]: use-after-free in alist_add()
(SuyueGuo)
Solution: Lock the current window, so that the reference to
the argument list remains valid.
This fixes CVE-2024-43374
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -359,6 +359,7 @@ func Test_argv()
|
||||
call assert_equal('', argv(1, 100))
|
||||
call assert_equal([], argv(-1, 100))
|
||||
call assert_equal('', argv(10, -1))
|
||||
%argdelete
|
||||
endfunc
|
||||
|
||||
" Test for the :argedit command
|
||||
@@ -744,4 +745,26 @@ func Test_all_command()
|
||||
%bw!
|
||||
endfunc
|
||||
|
||||
" Test for deleting buffer when creating an arglist. This was accessing freed
|
||||
" memory
|
||||
func Test_crash_arglist_uaf()
|
||||
"%argdelete
|
||||
new one
|
||||
au BufAdd XUAFlocal :bw
|
||||
"call assert_fails(':arglocal XUAFlocal', 'E163:')
|
||||
arglocal XUAFlocal
|
||||
au! BufAdd
|
||||
bw! XUAFlocal
|
||||
|
||||
au BufAdd XUAFlocal2 :bw
|
||||
new two
|
||||
new three
|
||||
arglocal
|
||||
argadd XUAFlocal2 Xfoobar
|
||||
bw! XUAFlocal2
|
||||
bw! two
|
||||
|
||||
au! BufAdd
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
Reference in New Issue
Block a user