diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-03-15 12:55:58 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-03-15 12:55:58 +0100 |
commit | f1551964448607f8222de2d8f0992ea43eb2fe67 (patch) | |
tree | 965aa22ad570f1ed6dfce1daa1621ba8c714b8b3 /src | |
parent | 346418c624f1bc7c04c98907134a2b284e6452dd (diff) |
patch 7.4.1565v7.4.1565
Problem: Crash when assert_equal() runs into a NULL string.
Solution: Check for NULL. (Dominique) Add a test.
Diffstat (limited to 'src')
-rw-r--r-- | src/eval.c | 6 | ||||
-rw-r--r-- | src/testdir/test_assert.vim | 15 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 23 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c index eadb802b30..425ab688f9 100644 --- a/src/eval.c +++ b/src/eval.c @@ -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) { diff --git a/src/testdir/test_assert.vim b/src/testdir/test_assert.vim index 6d2f80094a..df2636d7bc 100644 --- a/src/testdir/test_assert.vim +++ b/src/testdir/test_assert.vim @@ -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 diff --git a/src/version.c b/src/version.c index 3cab689794..59c7714c88 100644 --- 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 */ /**/ + 1565, +/**/ 1564, /**/ 1563, |