comparison src/eval.c @ 20156:49694eceaa55 v8.2.0633

patch 8.2.0633: crash when using null partial in filter() Commit: https://github.com/vim/vim/commit/9d8d0b5c644ea53364d04403740b3f23e57c1497 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Apr 24 22:47:31 2020 +0200 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 https://github.com/vim/vim/issues/5976)
author Bram Moolenaar <Bram@vim.org>
date Fri, 24 Apr 2020 23:00:04 +0200
parents fe8d0a4344df
children 94f05de75e9f
comparison
equal deleted inserted replaced
20155:f413c0207fd1 20156:49694eceaa55
238 return FAIL; 238 return FAIL;
239 } 239 }
240 else if (expr->v_type == VAR_PARTIAL) 240 else if (expr->v_type == VAR_PARTIAL)
241 { 241 {
242 partial_T *partial = expr->vval.v_partial; 242 partial_T *partial = expr->vval.v_partial;
243
244 if (partial == NULL)
245 return FAIL;
243 246
244 if (partial->pt_func != NULL && partial->pt_func->uf_dfunc_idx >= 0) 247 if (partial->pt_func != NULL && partial->pt_func->uf_dfunc_idx >= 0)
245 { 248 {
246 if (call_def_function(partial->pt_func, argc, argv, rettv) == FAIL) 249 if (call_def_function(partial->pt_func, argc, argv, rettv) == FAIL)
247 return FAIL; 250 return FAIL;
6414 } 6417 }
6415 if ((typ1->v_type == VAR_PARTIAL 6418 if ((typ1->v_type == VAR_PARTIAL
6416 && typ1->vval.v_partial == NULL) 6419 && typ1->vval.v_partial == NULL)
6417 || (typ2->v_type == VAR_PARTIAL 6420 || (typ2->v_type == VAR_PARTIAL
6418 && typ2->vval.v_partial == NULL)) 6421 && typ2->vval.v_partial == NULL))
6419 // when a partial is NULL assume not equal 6422 // When both partials are NULL, then they are equal.
6420 n1 = FALSE; 6423 // Otherwise they are not equal.
6424 n1 = (typ1->vval.v_partial == typ2->vval.v_partial);
6421 else if (type_is) 6425 else if (type_is)
6422 { 6426 {
6423 if (typ1->v_type == VAR_FUNC && typ2->v_type == VAR_FUNC) 6427 if (typ1->v_type == VAR_FUNC && typ2->v_type == VAR_FUNC)
6424 // strings are considered the same if their value is 6428 // strings are considered the same if their value is
6425 // the same 6429 // the same