Mercurial > hg > index.cgi
changeset 389:2d9b7ae6c329
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 <erik@6809.org> for the patch.
author | William Astle <lost@l-w.ca> |
---|---|
date | Mon, 13 Jul 2015 21:37:49 -0600 |
parents | f813a56178c0 |
children | 1ebb5a0b2874 |
files | lwasm/insn_gen.c |
diffstat | 1 files changed, 2 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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)) {