all repos — mgba @ 278ac5f35bc089efe939466c957259bb66a59a9d

mGBA Game Boy Advance Emulator

GBA I/O: Fix writing to out-of-bounds 8-bit I/O registers
Jeffrey Pfau jeffrey@endrift.com
Wed, 28 Sep 2016 12:57:58 -0700
commit

278ac5f35bc089efe939466c957259bb66a59a9d

parent

e6b4144ba21fc63a774f17fc2804948fd8bd1f36

1 files changed, 3 insertions(+), 0 deletions(-)

jump to
M src/gba/io.csrc/gba/io.c

@@ -562,6 +562,9 @@ GBAStop(gba);

} return; } + if (address > SIZE_IO) { + return; + } uint16_t value16 = value << (8 * (address & 1)); value16 |= (gba->memory.io[(address & (SIZE_IO - 1)) >> 1]) & ~(0xFF << (8 * (address & 1))); GBAIOWrite(gba, address & 0xFFFFFFFE, value16);