peproc: Fix sigsevg in smacro expansion

In case if smacro is called with inapropriate
number of arguments exit early. Actually we have
to handle this situation more gracefully but
this requires a way more efforts than two
line patches (need to refactor macro expansion).

https://bugzilla.nasm.us/show_bug.cgi?id=3392431

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Cyrill Gorcunov 2017-10-22 18:42:07 +03:00
parent c9244eaadd
commit 59ce1c67b1

View file

@ -4430,6 +4430,16 @@ again:
ttt->text, 0);
ptail = &pt->next;
ttt = ttt->next;
if (!ttt && i > 0) {
/*
* FIXME: Need to handle more gracefully,
* exiting early on agruments analysis.
*/
nasm_error(ERR_FATAL,
"macro `%s' expects %d args",
mstart->text,
(int)paramsize[t->type - TOK_SMAC_PARAM]);
}
}
tline = pcopy;
} else if (t->type == TOK_PREPROC_Q) {