0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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)
This commit is contained in:
Bram Moolenaar
2021-12-30 13:29:00 +00:00
parent 5d2e007ccb
commit 13789bf103
4 changed files with 53 additions and 0 deletions

View File

@@ -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;
}