summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-05-05 23:41:14 -0700
committerMichael Pavone <pavone@retrodev.com>2017-05-05 23:41:14 -0700
commitaf64ed7d263f8be0735de61beb8d88ccbf4d60a8 (patch)
treee349c1127b2c00f067c85563b26a2d626243ab04
parent4dab06dd79a27f462f5071e6162c7231b49d66fe (diff)
Decode JMP or JSR with an invalid addressing mode as an invalid instruction
-rw-r--r--68kinst.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/68kinst.c b/68kinst.c
index e650c88..acffc00 100644
--- a/68kinst.c
+++ b/68kinst.c
@@ -904,7 +904,11 @@ uint16_t * m68k_decode(uint16_t * istream, m68kinst * decoded, uint32_t address)
}
decoded->extra.size = OPSIZE_UNSIZED;
istream = m68k_decode_op(istream, OPSIZE_UNSIZED, &(decoded->src));
- if (!istream) {
+ if (
+ !istream
+ || (decoded->src.addr_mode < MODE_AREG_DISPLACE && decoded->src.addr_mode != MODE_AREG_INDIRECT)
+ || decoded->src.addr_mode == MODE_IMMEDIATE
+ ) {
decoded->op = M68K_INVALID;
break;
}