0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.2172: Vim9: number of arguments is not always checked

Problem:    Vim9: number of arguments is not always checked. (Yegappan
            Lakshmanan)
Solution:   Check number of arguments when calling function by name.
This commit is contained in:
Bram Moolenaar
2020-12-20 21:10:17 +01:00
parent 61e07b2394
commit 5082471f91
6 changed files with 55 additions and 8 deletions

View File

@@ -606,6 +606,17 @@ call_ufunc(ufunc_T *ufunc, int argcount, ectx_T *ectx, isn_T *iptr)
return FAIL;
if (ufunc->uf_def_status == UF_COMPILED)
{
int error = check_user_func_argcount(ufunc, argcount);
if (error != FCERR_UNKNOWN)
{
if (error == FCERR_TOOMANY)
semsg(_(e_toomanyarg), ufunc->uf_name);
else
semsg(_(e_toofewarg), ufunc->uf_name);
return FAIL;
}
// The function has been compiled, can call it quickly. For a function
// that was defined later: we can call it directly next time.
if (iptr != NULL)