comparison 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
comparison
equal deleted inserted replaced
272:cfeb196251e4 273:1409debcb1a0
86 { 86 {
87 lc = strtol(p1, NULL, 10); 87 lc = strtol(p1, NULL, 10);
88 } 88 }
89 else if (!strcmp(line + 2, "SETNOEXPANDSTART")) 89 else if (!strcmp(line + 2, "SETNOEXPANDSTART"))
90 { 90 {
91 as -> line_tail -> noexpand_start = 1; 91 as -> line_tail -> noexpand_start += 1;
92 } 92 }
93 else if (!strcmp(line + 2, "SETNOEXPANDEND")) 93 else if (!strcmp(line + 2, "SETNOEXPANDEND"))
94 { 94 {
95 as -> line_tail -> noexpand_end = 1; 95 as -> line_tail -> noexpand_end += 1;
96 } 96 }
97 lw_free(line); 97 lw_free(line);
98 if (lc == 0) 98 if (lc == 0)
99 lc = 1; 99 lc = 1;
100 continue; 100 continue;