mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.2574: Vim9: crash when calling partial with wrong function
Problem: Vim9: crash when calling partial with wrong function. Solution: Check argument types of called function. (closes #7912)
This commit is contained in:
@@ -797,7 +797,27 @@ call_by_name(char_u *name, int argcount, ectx_T *ectx, isn_T *iptr)
|
||||
}
|
||||
|
||||
if (ufunc != NULL)
|
||||
{
|
||||
if (ufunc->uf_arg_types != NULL)
|
||||
{
|
||||
int i;
|
||||
typval_T *argv = STACK_TV_BOT(0) - argcount;
|
||||
|
||||
// The function can change at runtime, check that the argument
|
||||
// types are correct.
|
||||
for (i = 0; i < argcount; ++i)
|
||||
{
|
||||
type_T *type = i < ufunc->uf_args.ga_len
|
||||
? ufunc->uf_arg_types[i] : ufunc->uf_va_type;
|
||||
|
||||
if (type != NULL && check_typval_arg_type(type,
|
||||
&argv[i], i + 1) == FAIL)
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
return call_ufunc(ufunc, NULL, argcount, ectx, iptr);
|
||||
}
|
||||
|
||||
return FAIL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user