changeset 8554:7d3548ae729d v7.4.1567

commit https://github.com/vim/vim/commit/1abb502635c7f317e05a0cf3ea067101f9d684f5 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Mar 15 13:33:55 2016 +0100 patch 7.4.1567 Problem: Crash in assert_fails(). Solution: Check for NULL. (Dominique Pelle) Add a test.
author Christian Brabandt <cb@256bit.org>
date Tue, 15 Mar 2016 13:45:05 +0100
parents ed28f4f1d7cf
children b7b50df7b7a1
files src/eval.c src/testdir/test_assert.vim src/version.c
diffstat 3 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -9386,7 +9386,8 @@ f_assert_fails(typval_T *argvars, typval
 	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],
--- a/src/testdir/test_assert.vim
+++ b/src/testdir/test_assert.vim
@@ -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
--- a/src/version.c
+++ b/src/version.c
@@ -744,6 +744,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1567,
+/**/
     1566,
 /**/
     1565,