summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2017-10-22 15:25:48 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2017-10-22 15:25:48 +0300
commitc9244eaadd05b27637cde06021bac3fa1d920aa3 (patch)
tree043f031be6a6c57b2561833d57dbfae1f0a345cd
parent3144e84add8b152cc7a71e44617ce6f21daa4ba3 (diff)
downloadnasm-c9244eaadd05b27637cde06021bac3fa1d920aa3.tar.gz
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 <gorcunov@gmail.com>
-rw-r--r--asm/preproc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/asm/preproc.c b/asm/preproc.c
index 7b1e2bff..404d3ecb 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;
}
}
}