summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2015-05-22 21:11:41 -0700
committerMichael Pavone <pavone@retrodev.com>2015-05-22 21:11:41 -0700
commiteb8ad570f140b57480ba8ce28819d7cd68d6548e (patch)
treeffa43823529fe1f97957b8a4a2e2f4844252bde5
parent808e9ca1a04cf5c5a6077e5f3a11f289db2093b6 (diff)
Fix out of bounds memory access when an instruction wraps around the end of memory
-rw-r--r--m68k_core.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/m68k_core.c b/m68k_core.c
index 1ac4ca2..8bf9582 100644
--- a/m68k_core.c
+++ b/m68k_core.c
@@ -636,6 +636,7 @@ void map_native_address(m68k_context * context, uint32_t address, code_ptr nativ
uint32_t offset = address % NATIVE_CHUNK_SIZE;
native_code_map[chunk].offsets[offset] = native_addr-native_code_map[chunk].base;
for(address++,size-=2; size; address++,size-=2) {
+ address &= opts->gen.address_mask >> 1;
chunk = address / NATIVE_CHUNK_SIZE;
offset = address % NATIVE_CHUNK_SIZE;
if (!native_code_map[chunk].base) {