mirror of https://github.com/mgba-emu/mgba.git
GBA I/O: Fix writing to out-of-bounds 8-bit I/O registers
This commit is contained in:
parent
e6b4144ba2
commit
278ac5f35b
|
@ -562,6 +562,9 @@ void GBAIOWrite8(struct GBA* gba, uint32_t address, uint8_t value) {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (address > SIZE_IO) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
uint16_t value16 = value << (8 * (address & 1));
|
uint16_t value16 = value << (8 * (address & 1));
|
||||||
value16 |= (gba->memory.io[(address & (SIZE_IO - 1)) >> 1]) & ~(0xFF << (8 * (address & 1)));
|
value16 |= (gba->memory.io[(address & (SIZE_IO - 1)) >> 1]) & ~(0xFF << (8 * (address & 1)));
|
||||||
GBAIOWrite(gba, address & 0xFFFFFFFE, value16);
|
GBAIOWrite(gba, address & 0xFFFFFFFE, value16);
|
||||||
|
|
Loading…
Reference in New Issue