# HG changeset patch # User William Astle # Date 1377971160 21600 # Node ID 3c421f24c9b80c98a14960f21a21555f7cf0a93e # Parent cb24ffb23f7c1edc9b84db53433a8d06956d04ea Make <...,PCR complain on byte overflows Richard Goedeken 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. diff -r cb24ffb23f7c -r 3c421f24c9b8 lwasm/insn_indexed.c --- 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)