0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 9.0.1138: crash when expecting varargs but it is something else

Problem:    Crash when expecting varargs but it is something else.
Solution:   Only use the member when the type is a list. (closes #11774)
This commit is contained in:
Bram Moolenaar
2023-01-03 12:33:26 +00:00
parent ea720aea85
commit 36818a9daa
4 changed files with 26 additions and 2 deletions

View File

@@ -1841,7 +1841,13 @@ check_func_args_from_type(
type_T *expected;
if (varargs && i >= type->tt_argcount - 1)
expected = type->tt_args[type->tt_argcount - 1]->tt_member;
{
expected = type->tt_args[type->tt_argcount - 1];
if (expected != NULL && expected->tt_type == VAR_LIST)
expected = expected->tt_member;
if (expected == NULL)
expected = &t_any;
}
else if (i >= type->tt_min_argcount
&& actual->tt_type == VAR_SPECIAL)
expected = &t_any;