# HG changeset patch # User William Astle # Date 1436845069 21600 # Node ID 2d9b7ae6c3292c53b4b6c7d3443e32d074e51c76 # Parent f813a56178c0679361418b4901f72f1c9a031522 Throw error if address overflows in extended mode This may or may not cause extra problems due to sloppiness in dealing with calculations that overflow in 16 bits. However, presumably it is a good idea so unless something major pops up, it seems like a good idea. Thanks to Erik G for the patch. diff -r f813a56178c0 -r 2d9b7ae6c329 lwasm/insn_gen.c --- a/lwasm/insn_gen.c Mon Jul 13 21:34:50 2015 -0600 +++ b/lwasm/insn_gen.c Mon Jul 13 21:37:49 2015 -0600 @@ -111,6 +111,8 @@ // if we have a constant now, figure out dp vs nondp if (lw_expr_istype(s, lw_expr_type_int)) { + if (s -> value > 0xffff) lwasm_register_error(as, l, E_BYTE_OVERFLOW); + v1 = lw_expr_intval(s); if (((v1 >> 8) & 0xff) == (l -> dpval & 0xff)) {