From eb8ad570f140b57480ba8ce28819d7cd68d6548e Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Fri, 22 May 2015 21:11:41 -0700 Subject: Fix out of bounds memory access when an instruction wraps around the end of memory --- m68k_core.c | 1 + 1 file changed, 1 insertion(+) 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) { -- cgit v1.2.3