mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-10-10 00:25:06 -04:00
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:
@@ -4430,6 +4430,16 @@ again:
|
|||||||
ttt->text, 0);
|
ttt->text, 0);
|
||||||
ptail = &pt->next;
|
ptail = &pt->next;
|
||||||
ttt = ttt->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;
|
tline = pcopy;
|
||||||
} else if (t->type == TOK_PREPROC_Q) {
|
} else if (t->type == TOK_PREPROC_Q) {
|
||||||
|
|||||||
Reference in New Issue
Block a user