diff lwasm/list.c @ 542:f3018ed5e30e

Fix listing to not rely on undefined memory before the start of instab This is exactly the same bug that affected symbol value registration and was fixed in changeset 65c2085e0398. This time, fix it when creating listings.
author William Astle <lost@l-w.ca>
date Wed, 17 Aug 2022 17:06:30 -0600
parents 10f62dc61a75
children 3a173cefc814
line wrap: on
line diff
--- a/lwasm/list.c	Wed Aug 17 17:05:01 2022 -0600
+++ b/lwasm/list.c	Wed Aug 17 17:06:30 2022 -0600
@@ -181,7 +181,7 @@
 		else
 		{
 			lw_expr_t te;
-			if (instab[cl -> insn].flags & lwasm_insn_setdata)
+			if ((cl -> insn >= 0) && (instab[cl -> insn].flags & lwasm_insn_setdata))
 				te = lw_expr_copy(cl -> daddr);
 			else
 				te = lw_expr_copy(cl -> addr);