From bd739528ad1f715cd21e5afe2f60b73a8011c3ee Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Mon, 29 Oct 2012 14:35:50 +0100 Subject: [PATCH] ast_call_check_types should not check more parameters than actually available in both the call and the function type - fixes a crash introduced by this on variadic functions --- ast.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ast.c b/ast.c index d8ca8bd..5ec1d3a 100644 --- a/ast.c +++ b/ast.c @@ -674,9 +674,12 @@ bool ast_call_check_types(ast_call *self) { size_t i; bool retval = true; - const ast_expression *func = self->func; + const ast_expression *func = self->func; + size_t count = self->params_count; + if (count > func->expression.params_count) + count = func->expression.params_count; - for (i = 0; i < self->params_count; ++i) { + for (i = 0; i < count; ++i) { if (!ast_compare_type(self->params[i], (ast_expression*)(func->expression.params[i]))) { asterror(ast_ctx(self), "invalid type for parameter %u in function call", (unsigned int)(i+1)); -- 2.39.2