vim-patch:8.2.3756: might crash when callback is not valid

Problem:    might crash when callback is not valid.
Solution:   Check for valid callback. (Yegappan Lakshmanan, closes vim/vim#9293)

4dc24eb5ad

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
zeertzjq
2022-11-07 11:04:33 +08:00
parent 42e44d6d33
commit d7bd7f13a8
7 changed files with 42 additions and 10 deletions

View File

@@ -5860,6 +5860,7 @@ bool callback_from_typval(Callback *const callback, typval_T *const arg)
return true;
}
/// @return whether the callback could be called.
bool callback_call(Callback *const callback, const int argcount_in, typval_T *const argvars_in,
typval_T *const rettv)
FUNC_ATTR_NONNULL_ALL
@@ -8705,9 +8706,9 @@ bool invoke_prompt_interrupt(void)
argv[0].v_type = VAR_UNKNOWN;
got_int = false; // don't skip executing commands
callback_call(&curbuf->b_prompt_interrupt, 0, argv, &rettv);
int ret = callback_call(&curbuf->b_prompt_interrupt, 0, argv, &rettv);
tv_clear(&rettv);
return true;
return ret != FAIL;
}
/// Compare "typ1" and "typ2". Put the result in "typ1".