vim-patch:9.0.1511: crash when using wrong arg types to assert_match() (#23507)

Problem:    Crash when using wrong arg types to assert_match().
Solution:   Check for NULL pointer. (closes vim/vim#12349)

12e7a1fe75
This commit is contained in:
zeertzjq
2023-05-06 20:00:17 +08:00
committed by GitHub
parent a67b76943a
commit ca5a810c4a
2 changed files with 22 additions and 5 deletions

View File

@@ -324,6 +324,23 @@ func Test_assert_fail_fails()
call remove(v:errors, 0)
endfunc
func Test_assert_wrong_arg_emsg_off()
CheckFeature folding
new
call setline(1, ['foo', 'bar'])
1,2fold
" This used to crash Vim
let &l:foldtext = 'assert_match({}, {})'
redraw!
let &l:foldtext = 'assert_equalfile({}, {})'
redraw!
bwipe!
endfunc
func Test_assert_fails_in_try_block()
try
call assert_equal(0, assert_fails('throw "error"'))