diff lwasm/pass1.c @ 273:1409debcb1a0

Fix crash on listing when nested noexpand macros are used Macros flagged noexpand were causing a segfault during listing. The problem was incorrect accounting for nesting levels for noexpand macros causing the listing handler to fall off the end of the program in certain circumstances and in other circumstances it would fail to suppress expansion. Both the segfault in the case of misbehaviour and the misbhaviour itself are corrected with this update. If you do not use nested noexpand macros, this bug has no effect.
author William Astle <lost@l-w.ca>
date Sat, 25 May 2013 13:35:46 -0600
parents 3604d0ef06c6
children 9f7889139b06
line wrap: on
line diff
--- a/lwasm/pass1.c	Sat Apr 20 11:00:11 2013 -0600
+++ b/lwasm/pass1.c	Sat May 25 13:35:46 2013 -0600
@@ -88,11 +88,11 @@
 			}
 			else if (!strcmp(line + 2, "SETNOEXPANDSTART"))
 			{
-				as -> line_tail -> noexpand_start = 1;
+				as -> line_tail -> noexpand_start += 1;
 			}
 			else if (!strcmp(line + 2, "SETNOEXPANDEND"))
 			{
-				as -> line_tail -> noexpand_end = 1;
+				as -> line_tail -> noexpand_end += 1;
 			}
 			lw_free(line);
 			if (lc == 0)