1
0
forked from aniani/vim

patch 9.0.1511: crash when using wrong arg types to assert_match()

Problem:    Crash when using wrong arg types to assert_match().
Solution:   Check for NULL pointer. (closes #12349)
This commit is contained in:
zeertzjq
2023-05-06 12:20:05 +01:00
committed by Bram Moolenaar
parent 70e8028a4d
commit 12e7a1fe75
3 changed files with 30 additions and 11 deletions

View File

@@ -335,6 +335,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"'))