From 4c276bbd1887c09350fca4bdb355a2afde3ef471 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 15 Apr 2023 13:10:36 +0800 Subject: vim-patch:8.2.0103: using null object with execute() has strange effects Problem: Using null object with execute() has strange effects. Solution: Give an error message ofr Job and Channel. https://github.com/vim/vim/commit/e2a8f0773e91685843c062b1e48259712d5f2213 Co-authored-by: Bram Moolenaar --- src/nvim/eval/typval.c | 2 +- src/nvim/globals.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 91be41751e..7c982de61e 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -3806,7 +3806,7 @@ static const char *const str_errors[] = { [VAR_DICT]= N_("E731: using Dictionary as a String"), [VAR_FLOAT]= e_float_as_string, [VAR_BLOB]= N_("E976: using Blob as a String"), - [VAR_UNKNOWN]= N_("E908: using an invalid value as a String"), + [VAR_UNKNOWN]= e_inval_string, }; #undef FUNC_ERROR diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 7653076e39..e406d93494 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -998,6 +998,7 @@ EXTERN const char e_listarg[] INIT(= N_("E686: Argument of %s must be a List")); EXTERN const char e_unsupportedoption[] INIT(= N_("E519: Option not supported")); EXTERN const char e_fnametoolong[] INIT(= N_("E856: Filename too long")); EXTERN const char e_float_as_string[] INIT(= N_("E806: using Float as a String")); +EXTERN const char e_inval_string[] INIT(= N_("E908: using an invalid value as a String")); EXTERN const char e_cannot_edit_other_buf[] INIT(= N_("E788: Not allowed to edit another buffer now")); EXTERN const char e_cmdmap_err[] INIT(= N_("E5520: mapping must end with ")); -- cgit From 4b49f312a05214d5d1974f7ac2702ffb407fc558 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 15 Apr 2023 13:17:32 +0800 Subject: 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) https://github.com/vim/vim/commit/9d8d0b5c644ea53364d04403740b3f23e57c1497 Co-authored-by: Bram Moolenaar --- src/nvim/eval.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 6a8b24ceed..46cd837a73 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -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 -- cgit From 85741677c86f7686e3597a310f8059608e7816fb Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 15 Apr 2023 13:31:30 +0800 Subject: vim-patch:8.2.0634: crash with null partial and blob Problem: Crash with null partial and blob. Solution: Check for NULL pointer. Add more tests. (Yegappan Lakshmanan, closes vim/vim#5984) https://github.com/vim/vim/commit/92b83ccfda7a1d654ccaaf161a9c8a8e01fbcf76 Co-authored-by: Bram Moolenaar --- src/nvim/eval.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 46cd837a73..f555d973e4 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -4059,7 +4059,10 @@ char *partial_name(partial_T *pt) if (pt->pt_name != NULL) { return pt->pt_name; } - return pt->pt_func->uf_name; + if (pt->pt_func != NULL) { + return pt->pt_func->uf_name; + } + return ""; } static void partial_free(partial_T *pt) -- cgit