From 13789bf10338a0d049c78acfdc0870fc63e63f4f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 30 Dec 2021 13:29:00 +0000 Subject: patch 8.2.3945: Vim9: partial variable argument types are wrong Problem: Vim9: partial variable argument types are wrong, leading to a crash. Solution: When adjusting the argument count also adjust the argument types. (closes #9433) --- src/userfunc.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/userfunc.c') diff --git a/src/userfunc.c b/src/userfunc.c index d4d28c529..85a1cd315 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -3326,6 +3326,7 @@ call_func( int argv_base = 0; partial_T *partial = funcexe->fe_partial; type_T check_type; + type_T *check_type_args[MAX_FUNC_ARGS]; // Initialize rettv so that it is safe for caller to invoke clear_tv(rettv) // even when call_func() returns FAIL. @@ -3377,6 +3378,11 @@ call_func( // make a copy of the type with the correction. check_type = *funcexe->fe_check_type; funcexe->fe_check_type = &check_type; + check_type.tt_args = check_type_args; + CLEAR_FIELD(check_type_args); + for (i = 0; i < check_type.tt_argcount; ++i) + check_type_args[i + partial->pt_argc] = + check_type.tt_args[i]; check_type.tt_argcount += partial->pt_argc; check_type.tt_min_argcount += partial->pt_argc; } -- cgit v1.2.1