[nasm:nasm-2.16.xx] BR 3392893: preproc: correctly handle empty %rep blocks

nasm-bot for H. Peter Anvin hpa at zytor.com
Fri Oct 13 20:57:03 PDT 2023


Commit-ID:  2e9120e56f47706d51f344dbcc398d3b4eff7afb
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=2e9120e56f47706d51f344dbcc398d3b4eff7afb
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Fri, 13 Oct 2023 20:51:52 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Fri, 13 Oct 2023 20:51:52 -0700

BR 3392893: preproc: correctly handle empty %rep blocks

When expanding %rep blocks, if any of the %rep blocks are empty, there
may be need to unwind the %rep stack multiple times. The code would
not do so -- there was a break; in the loop, which incidentally turned
it into something that wasn't a loop at all.

Reported-by: E. C. Maslock <pushbx at ulukai.org>
Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 asm/preproc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/asm/preproc.c b/asm/preproc.c
index 85c19890..928b93b6 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -7633,7 +7633,8 @@ static Token *pp_tokline(void)
                     ll->where = l->where;
                     istk->expansion = ll;
                 }
-                break;
+                l = istk->expansion;
+                continue;
             } else {
                 MMacro *m = istk->mstk.mstk;
 


More information about the Nasm-commits mailing list