]> Shamusworld >> Repos - rmac/commitdiff
Fix for assembly getting stuck in an infinite loop when a INCLUDEd file inside an...
authorggn <ggn.dbug@gmail.com>
Mon, 16 Nov 2015 11:39:50 +0000 (13:39 +0200)
committerShamus Hammons <jlhamm@acm.org>
Tue, 17 Nov 2015 13:28:44 +0000 (07:28 -0600)
token.c

diff --git a/token.c b/token.c
index 84faa8f157bc5a9157f60e25e88dbda49e4df0f3..3031895c1e5e63d5e451ab85166527ddb6b68da3 100644 (file)
--- a/token.c
+++ b/token.c
@@ -912,8 +912,13 @@ retry:
                if ((ln = GetNextLine()) == NULL)
                {
 if (verb_flag) printf("TokenizeLine: Calling fpop() from SRC_IFILE...\n");
-                       fpop();                                                 // Pop input level
-                       goto retry;                                             // Try for more lines 
+                       if (fpop() == 0)                                // Pop input level
+                               goto retry;                                     // Try for more lines 
+                       else
+                       {
+                               ifent->if_prev = (IFENT *) - 1; //Signal Assemble() that we have reached EOF with unbalanced if/endifs
+                               return TKEOF;
+                       }
                }
 
                curlineno++;                                            // Bump line number