Mercurial > repos > blastem
diff m68k_core.c @ 725:a92ca6f0ed83
Fix out of bounds memory access when an instruction wraps around the end of memory
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 22 May 2015 21:11:41 -0700 |
parents | f9b80a78d9a6 |
children | 7367b14ac01c |
line wrap: on
line diff
--- 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) {