[Nasm-commits] [nasm:nasm-2.15.xx] BR 3392668: in %define, don't set "definining" until confirmed
nasm-bot for H. Peter Anvin (Intel)
hpa at zytor.com
Thu Jun 4 19:56:57 PDT 2020
Commit-ID: 7cfd01868cf17ea714938db093dad0845fb086f9
Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=7cfd01868cf17ea714938db093dad0845fb086f9
Author: H. Peter Anvin (Intel) <hpa at zytor.com>
AuthorDate: Mon, 1 Jun 2020 12:04:35 -0700
Committer: H. Peter Anvin (Intel) <hpa at zytor.com>
CommitDate: Mon, 1 Jun 2020 12:04:35 -0700
BR 3392668: in %define, don't set "definining" until confirmed
Don't set "defining" until the macro definition is successfully parsed
and we know for sure that we are going to define the macro.
Together with:
a762cd4e5402a360 BR 3392668: preproc: test for macro in TOK_LOCAL_SYMBOL
... this addresses BR 3392668.
Reported-by: <puppet at zju.edu.cn>
Signed-off-by: H. Peter Anvin (Intel) <hpa at zytor.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa at zytor.com>
---
asm/preproc.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/asm/preproc.c b/asm/preproc.c
index c7b2e7d4..3873d9bf 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -3807,17 +3807,21 @@ issue_error:
case PP_RMACRO:
case PP_MACRO:
+ {
+ MMacro *def;
+
nasm_assert(!defining);
- nasm_new(defining);
- defining->casesense = casesense;
- defining->dstk.mmac = defining;
+ nasm_new(def);
+ def->casesense = casesense;
+ def->dstk.mmac = defining;
if (op == PP_RMACRO)
- defining->max_depth = nasm_limit[LIMIT_MACRO_LEVELS];
- if (!parse_mmacro_spec(tline, defining, dname)) {
- nasm_free(defining);
+ def->max_depth = nasm_limit[LIMIT_MACRO_LEVELS];
+ if (!parse_mmacro_spec(tline, def, dname)) {
+ nasm_free(def);
goto done;
}
+ defining = def;
src_get(&defining->xline, &defining->fname);
mmac = (MMacro *) hash_findix(&mmacros, defining->name);
@@ -3834,6 +3838,7 @@ issue_error:
mmac = mmac->next;
}
break;
+ }
case PP_ENDM:
case PP_ENDMACRO:
More information about the Nasm-commits
mailing list