0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.0633: crash when using null partial in filter()

Problem:    Crash when using null partial in filter().
Solution:   Fix crash.  Add more tests. (Yegappan Lakshmanan, closes #5976)
This commit is contained in:
Bram Moolenaar
2020-04-24 22:47:31 +02:00
parent 92c461ef1b
commit 9d8d0b5c64
14 changed files with 114 additions and 4 deletions

View File

@@ -241,6 +241,9 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv)
{
partial_T *partial = expr->vval.v_partial;
if (partial == NULL)
return FAIL;
if (partial->pt_func != NULL && partial->pt_func->uf_dfunc_idx >= 0)
{
if (call_def_function(partial->pt_func, argc, argv, rettv) == FAIL)
@@ -6416,8 +6419,9 @@ typval_compare(
&& typ1->vval.v_partial == NULL)
|| (typ2->v_type == VAR_PARTIAL
&& typ2->vval.v_partial == NULL))
// when a partial is NULL assume not equal
n1 = FALSE;
// When both partials are NULL, then they are equal.
// Otherwise they are not equal.
n1 = (typ1->vval.v_partial == typ2->vval.v_partial);
else if (type_is)
{
if (typ1->v_type == VAR_FUNC && typ2->v_type == VAR_FUNC)