# HG changeset patch # User Michael Pavone # Date 1432354301 25200 # Node ID a92ca6f0ed8359f9a03ac5e65705ea808a78cea1 # Parent 2174f92c5f9bbcde670790ad5eb98bbad9d0b5b9 Fix out of bounds memory access when an instruction wraps around the end of memory diff -r 2174f92c5f9b -r a92ca6f0ed83 m68k_core.c --- a/m68k_core.c Fri May 22 18:38:44 2015 -0700 +++ b/m68k_core.c Fri May 22 21:11:41 2015 -0700 @@ -636,6 +636,7 @@ 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) {