Mercurial > hg > index.cgi
diff lwasm/insn_indexed.c @ 282:3c421f24c9b8
Make <...,PCR complain on byte overflows
Richard Goedeken <Richard@fascinationsoftawre.com> reported that forcing 8
bit offsets relative to PCR would not complain if the magnitude of the
offset did not fit in 8 bits. This was the result of a missing test for the
byte overflow situation which has now been added.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sat, 31 Aug 2013 11:46:00 -0600 |
parents | 65510f1574e4 |
children | 210d261a614d |
line wrap: on
line diff
--- a/lwasm/insn_indexed.c Tue Jul 16 21:48:49 2013 -0600 +++ b/lwasm/insn_indexed.c Sat Aug 31 11:46:00 2013 -0600 @@ -581,6 +581,17 @@ { lw_expr_t e; + if (l -> lint == 1 && (l -> pb == 0x9c || l -> pb == 0x8c)) + { + int i; + e = lwasm_fetch_expr(l, 0); + i = lw_expr_intval(e); + if (i < -128 || i > 127) + { + lwasm_register_error(as, l, "Byte overflow"); + } + } + lwasm_emitop(l, instab[l -> insn].ops[0]); lwasm_emitop(l, l -> pb); if (l -> lint > 0)