diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2017-10-22 18:42:07 +0300 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2017-10-22 18:54:20 +0300 |
commit | 59ce1c67b16967c652765e62aa130b7e43f21dd4 (patch) | |
tree | 1e50f223c400c2cc84c8e5626213d593893d5393 | |
parent | c9244eaadd05b27637cde06021bac3fa1d920aa3 (diff) | |
download | nasm-59ce1c67b16967c652765e62aa130b7e43f21dd4.tar.gz |
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>
-rw-r--r-- | asm/preproc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/asm/preproc.c b/asm/preproc.c index 404d3ecb..cd4a9494 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -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) { |