diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-12-30 13:29:00 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-12-30 13:29:00 +0000 |
commit | 13789bf10338a0d049c78acfdc0870fc63e63f4f (patch) | |
tree | b2d619123d4f75d81a05864b9167b832a485d847 /src/userfunc.c | |
parent | 5d2e007ccbfbd749a1f201d06965b8811ff50e6e (diff) | |
download | vim-git-8.2.3945.tar.gz |
patch 8.2.3945: Vim9: partial variable argument types are wrongv8.2.3945
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)
Diffstat (limited to 'src/userfunc.c')
-rw-r--r-- | src/userfunc.c | 6 |
1 files changed, 6 insertions, 0 deletions
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; } |