mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 7.4.1567
Problem: Crash in assert_fails(). Solution: Check for NULL. (Dominique Pelle) Add a test.
This commit is contained in:
@@ -9386,7 +9386,8 @@ f_assert_fails(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
char_u buf[NUMBUFLEN];
|
||||
char *error = (char *)get_tv_string_buf_chk(&argvars[1], buf);
|
||||
|
||||
if (strstr((char *)vimvars[VV_ERRMSG].vv_str, error) == NULL)
|
||||
if (error == NULL
|
||||
|| strstr((char *)vimvars[VV_ERRMSG].vv_str, error) == NULL)
|
||||
{
|
||||
prepare_assert_error(&ga);
|
||||
fill_assert_error(&ga, &argvars[2], NULL, &argvars[1],
|
||||
|
@@ -62,6 +62,12 @@ func Test_compare_fail()
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Test_assert_fail_fails()
|
||||
call assert_fails('xxx', {})
|
||||
call assert_true(v:errors[0] =~ "Expected {} but got 'E731:")
|
||||
call remove(v:errors, 0)
|
||||
endfunc
|
||||
|
||||
|
||||
func Test_user_is_happy()
|
||||
smile
|
||||
|
@@ -743,6 +743,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1567,
|
||||
/**/
|
||||
1566,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user