mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 16:58:17 +00:00
vim-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 vim/vim#5976)
9d8d0b5c64
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -789,6 +789,9 @@ int eval_expr_typval(const typval_T *expr, typval_T *argv, int argc, typval_T *r
|
||||
}
|
||||
} else if (expr->v_type == VAR_PARTIAL) {
|
||||
partial_T *const partial = expr->vval.v_partial;
|
||||
if (partial == NULL) {
|
||||
return FAIL;
|
||||
}
|
||||
const char *const s = partial_name(partial);
|
||||
if (s == NULL || *s == NUL) {
|
||||
return FAIL;
|
||||
@@ -8640,8 +8643,9 @@ int typval_compare(typval_T *typ1, typval_T *typ2, exprtype_T type, bool ic)
|
||||
}
|
||||
if ((typ1->v_type == VAR_PARTIAL && 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) {
|
||||
// strings are considered the same if their value is
|
||||
|
Reference in New Issue
Block a user