From: nasm-bot f. C. G. <gor...@gm...> - 2017-10-22 12:27:35
|
Commit-ID: c9244eaadd05b27637cde06021bac3fa1d920aa3 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=c9244eaadd05b27637cde06021bac3fa1d920aa3 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 22 Oct 2017 15:25:48 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 22 Oct 2017 15:25:48 +0300 prepoc: mmacro -- Don't left nparam_max less than nparam_min Otherwise we hit nil dereference in best case. https://bugzilla.nasm.us/show_bug.cgi?id=3392436 Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/preproc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/asm/preproc.c b/asm/preproc.c index 7b1e2bf..404d3ec 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -1938,9 +1938,11 @@ static bool if_condition(Token * tline, enum preproc_token ct) nasm_error(ERR_NONFATAL, "unable to parse parameter count `%s'", tline->text); - if (searching.nparam_min > searching.nparam_max) + if (searching.nparam_min > searching.nparam_max) { nasm_error(ERR_NONFATAL, "minimum parameter count exceeds maximum"); + searching.nparam_max = searching.nparam_min; + } } } if (tline && tok_is_(tline->next, "+")) { @@ -2169,6 +2171,7 @@ static bool parse_mmacro_spec(Token *tline, MMacro *def, const char *directive) } if (def->nparam_min > def->nparam_max) { nasm_error(ERR_NONFATAL, "minimum parameter count exceeds maximum"); + def->nparam_max = def->nparam_min; } } } |