Fix segfault in unlimited params

This commit is contained in:
Bill Currie 2020-02-19 02:30:50 +09:00
parent c61d0b6ff0
commit 2d52da9c0d

View file

@ -330,8 +330,9 @@ find_function (expr_t *fexpr, expr_t *params)
return e; return e;
type.t.func.num_params++; type.t.func.num_params++;
} }
if (type.t.func.num_params > MAX_PARMS) i = type.t.func.num_params * sizeof (type_t);
return fexpr; type.t.func.param_types = alloca(i);
memset (type.t.func.param_types, 0, i);
for (i = 0, e = params; e; i++, e = e->next) { for (i = 0, e = params; e; i++, e = e->next) {
type.t.func.param_types[type.t.func.num_params - 1 - i] = get_type (e); type.t.func.param_types[type.t.func.num_params - 1 - i] = get_type (e);
if (e->type == ex_error) if (e->type == ex_error)