From af64ed7d263f8be0735de61beb8d88ccbf4d60a8 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Fri, 5 May 2017 23:41:14 -0700 Subject: Decode JMP or JSR with an invalid addressing mode as an invalid instruction --- 68kinst.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to '68kinst.c') 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; } -- cgit v1.2.3