diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-16 09:01:33 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-04-16 10:15:15 +0800 |
commit | f4d3e279e861dc37dd047c81a0807767a74d251b (patch) | |
tree | 96ebf30a32c73904ad4482e58dac2fb246cfb501 /src/nvim | |
parent | 08121ef69f47f8ad8f8903a732920412e24d30c1 (diff) | |
download | rneovim-f4d3e279e861dc37dd047c81a0807767a74d251b.tar.gz rneovim-f4d3e279e861dc37dd047c81a0807767a74d251b.tar.bz2 rneovim-f4d3e279e861dc37dd047c81a0807767a74d251b.zip |
vim-patch:8.2.2977: crash when using a null function reference
Problem: Crash when using a null function reference. (Naohiro Ono)
Solution: Check for an invalid function name. (closes vim/vim#8367)
https://github.com/vim/vim/commit/22db0d549f64aa3d8a6e366b70eb8d7e66933b82
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim')
-rw-r--r-- | src/nvim/eval.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 87633365b6..a5c81666c1 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -96,6 +96,7 @@ static const char *e_string_list_or_blob_required = N_("E1098: String, List or B static const char e_expression_too_recursive_str[] = N_("E1169: Expression too recursive: %s"); static const char e_dot_can_only_be_used_on_dictionary_str[] = N_("E1203: Dot can only be used on a dictionary: %s"); +static const char e_empty_function_name[] = N_("E1192: Empty function name"); static char * const namespace_char = "abglstvw"; @@ -3273,6 +3274,10 @@ static int call_func_rettv(char **const arg, evalarg_T *const evalarg, typval_T funcname = is_lua ? lua_funcname : partial_name(pt); } else { funcname = functv.vval.v_string; + if (funcname == NULL || *funcname == NUL) { + emsg(_(e_empty_function_name)); + goto theend; + } } } else { funcname = ""; @@ -3288,6 +3293,7 @@ static int call_func_rettv(char **const arg, evalarg_T *const evalarg, typval_T const int ret = get_func_tv(funcname, is_lua ? (int)(*arg - funcname) : -1, rettv, arg, evalarg, &funcexe); +theend: // Clear the funcref afterwards, so that deleting it while // evaluating the arguments is possible (see test55). if (evaluate) { |