[Nasm-commits] [nasm:nasm-2.15.xx] BR 3392669: in expand_one_smacro(), we may reach EOL before tafter

nasm-bot for H. Peter Anvin (Intel) hpa at zytor.com
Thu Jun 4 19:56:57 PDT 2020


Commit-ID:  6e71496e3c8a12838b8e21b97d48746830a07c06
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=6e71496e3c8a12838b8e21b97d48746830a07c06
Author:     H. Peter Anvin (Intel) <hpa at zytor.com>
AuthorDate: Mon, 1 Jun 2020 12:21:10 -0700
Committer:  H. Peter Anvin (Intel) <hpa at zytor.com>
CommitDate: Mon, 1 Jun 2020 12:21:10 -0700

BR 3392669: in expand_one_smacro(), we may reach EOL before tafter

If the rest of the line is consumed, we may never see tafter, so we
have to test for end of line at line 5412.  We already do at 5397, so
it clearly should have been there all along.

Reported-by: <puppet at zju.edu.cn>
Signed-off-by: H. Peter Anvin (Intel) <hpa at zytor.com>


---
 asm/preproc.c         |   2 +-
 test/br3392669-57.asm | Bin 0 -> 2790 bytes
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/asm/preproc.c b/asm/preproc.c
index 3873d9bf..e3014f3e 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -5409,7 +5409,7 @@ static SMacro *expand_one_smacro(Token ***tpp)
     }
 
     **tpp = tline;
-    for (t = tline; t != tafter; t = t->next)
+    for (t = tline; t && t != tafter; t = t->next)
         *tpp = &t->next;
 
     m->in_progress = false;
diff --git a/test/br3392669-57.asm b/test/br3392669-57.asm
new file mode 100644
index 00000000..71a07cb8
Binary files /dev/null and b/test/br3392669-57.asm differ


More information about the Nasm-commits mailing list