]> granicus.if.org Git - vim/commitdiff
patch 7.4.1565 v7.4.1565
authorBram Moolenaar <Bram@vim.org>
Tue, 15 Mar 2016 11:55:58 +0000 (12:55 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 15 Mar 2016 11:55:58 +0000 (12:55 +0100)
Problem:    Crash when assert_equal() runs into a NULL string.
Solution:   Check for NULL. (Dominique) Add a test.

src/eval.c
src/testdir/test_assert.vim
src/version.c

index eadb802b3046ec263fd63d7bfd77c5377870f26d..425ab688f97a47a7b3e12b95d0f48216734cd23f 100644 (file)
@@ -9240,6 +9240,12 @@ ga_concat_esc(garray_T *gap, char_u *str)
     char_u  *p;
     char_u  buf[NUMBUFLEN];
 
+    if (str == NULL)
+    {
+       ga_concat(gap, (char_u *)"NULL");
+       return;
+    }
+
     for (p = str; *p != NUL; ++p)
        switch (*p)
        {
index 6d2f80094aab3ad1e22ed44d81aa643c169db843..df2636d7bc3c374c579f27d64704f6ccaefea684 100644 (file)
@@ -48,6 +48,21 @@ func Test_wrong_error_type()
   call assert_equal(type([]), type(verrors))
 endfunc
 
+func Test_compare_fail()
+  let s:v = {}          
+  let s:x = {"a": s:v} 
+  let s:v["b"] = s:x   
+  let s:w = {"c": s:x, "d": ''}
+  try
+    call assert_equal(s:w, '')
+  catch
+    call assert_exception('E724:')
+    call assert_true(v:errors[0] =~ "Expected NULL but got ''")
+    call remove(v:errors, 0)
+  endtry
+endfunc
+
+
 func Test_user_is_happy()
   smile
   sleep 300m
index 3cab68979451f272ce46d0f3d9efaddd5b036cf7..59c7714c88cec16000d8981df0d12d09e7132b66 100644 (file)
@@ -743,6 +743,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1565,
 /**/
     1564,
 /**/