Mercurial > vim
diff src/vim9execute.c @ 23252:35583da6397e v8.2.2172
patch 8.2.2172: Vim9: number of arguments is not always checked
Commit: https://github.com/vim/vim/commit/5082471f91dd42ed8c35e0f649d0a6572e6fe3fc
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Dec 20 21:10:17 2020 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 20 Dec 2020 21:15:03 +0100 |
parents | 43532077b5ff |
children | 4b7e996354e0 |
line wrap: on
line diff
--- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -606,6 +606,17 @@ call_ufunc(ufunc_T *ufunc, int argcount, 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)