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)
diff --git a/src/eval.c b/src/eval.c
index 260ce96..659588f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -241,6 +241,9 @@
{
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 @@
&& 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)