[nasm:master] preproc: an empty %[] construct generates a null token, drop
nasm-bot for H. Peter Anvin
hpa at zytor.com
Mon Nov 7 17:12:37 PST 2022
Commit-ID: baae422e6124000616499629b88cecf9e69dfc55
Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=baae422e6124000616499629b88cecf9e69dfc55
Author: H. Peter Anvin <hpa at zytor.com>
AuthorDate: Mon, 7 Nov 2022 11:47:22 -0800
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Mon, 7 Nov 2022 11:47:22 -0800
preproc: an empty %[] construct generates a null token, drop
%[] amounts to an empty token; this needs to be handled specially so
that it gets properly dropped.
Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392806
Reported-by: C. Masloch <pushbx at ulukai.org>
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
asm/preproc.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/asm/preproc.c b/asm/preproc.c
index cb1669da..a016fda4 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -1677,9 +1677,13 @@ static Token *tokenize(const char *line)
if (!ep)
ep = p;
- *tail = t = new_Token(NULL, type, line, ep - line);
- *tok_text_buf(t) = firstchar; /* E.g. %{foo} -> {foo -> %foo */
- tail = &t->next;
+ toklen = ep - line;
+
+ if (toklen) {
+ *tail = t = new_Token(NULL, type, line, toklen);
+ *tok_text_buf(t) = firstchar; /* E.g. %{foo} -> {foo -> %foo */
+ tail = &t->next;
+ }
line = p;
}
More information about the Nasm-commits
mailing list