GBA BIOS: Fix invalid decompression bounds checking

This commit is contained in:
Vicki Pfau 2021-03-26 19:20:28 -07:00
parent 3ce0472963
commit 47d70582c0
2 changed files with 5 additions and 4 deletions

View File

@ -40,6 +40,7 @@ Emulation fixes:
- GBA BIOS: Improve HLE BIOS timing - GBA BIOS: Improve HLE BIOS timing
- GBA BIOS: Fix reloading video registers after reset (fixes mgba.io/i/1808) - GBA BIOS: Fix reloading video registers after reset (fixes mgba.io/i/1808)
- GBA BIOS: Make HLE BIOS calls interruptable (fixes mgba.io/i/1711 and mgba.io/i/1823) - GBA BIOS: Make HLE BIOS calls interruptable (fixes mgba.io/i/1711 and mgba.io/i/1823)
- GBA BIOS: Fix invalid decompression bounds checking
- GBA DMA: Linger last DMA on bus (fixes mgba.io/i/301 and mgba.io/i/1320) - GBA DMA: Linger last DMA on bus (fixes mgba.io/i/301 and mgba.io/i/1320)
- GBA DMA: Fix ordering and timing of overlapping DMAs - GBA DMA: Fix ordering and timing of overlapping DMAs
- GBA I/O: Green swap register should be readable - GBA I/O: Green swap register should be readable

View File

@ -525,7 +525,7 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
break; break;
case GBA_SWI_LZ77_UNCOMP_WRAM: case GBA_SWI_LZ77_UNCOMP_WRAM:
case GBA_SWI_LZ77_UNCOMP_VRAM: case GBA_SWI_LZ77_UNCOMP_VRAM:
if (cpu->gprs[0] < BASE_WORKING_RAM) { if (!(cpu->gprs[0] & 0x0E000000)) {
mLOG(GBA_BIOS, GAME_ERROR, "Bad LZ77 source"); mLOG(GBA_BIOS, GAME_ERROR, "Bad LZ77 source");
break; break;
} }
@ -541,7 +541,7 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
} }
break; break;
case GBA_SWI_HUFFMAN_UNCOMP: case GBA_SWI_HUFFMAN_UNCOMP:
if (cpu->gprs[0] < BASE_WORKING_RAM) { if (!(cpu->gprs[0] & 0x0E000000)) {
mLOG(GBA_BIOS, GAME_ERROR, "Bad Huffman source"); mLOG(GBA_BIOS, GAME_ERROR, "Bad Huffman source");
break; break;
} }
@ -558,7 +558,7 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
break; break;
case GBA_SWI_RL_UNCOMP_WRAM: case GBA_SWI_RL_UNCOMP_WRAM:
case GBA_SWI_RL_UNCOMP_VRAM: case GBA_SWI_RL_UNCOMP_VRAM:
if (cpu->gprs[0] < BASE_WORKING_RAM) { if (!(cpu->gprs[0] & 0x0E000000)) {
mLOG(GBA_BIOS, GAME_ERROR, "Bad RL source"); mLOG(GBA_BIOS, GAME_ERROR, "Bad RL source");
break; break;
} }
@ -576,7 +576,7 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
case GBA_SWI_DIFF_8BIT_UNFILTER_WRAM: case GBA_SWI_DIFF_8BIT_UNFILTER_WRAM:
case GBA_SWI_DIFF_8BIT_UNFILTER_VRAM: case GBA_SWI_DIFF_8BIT_UNFILTER_VRAM:
case GBA_SWI_DIFF_16BIT_UNFILTER: case GBA_SWI_DIFF_16BIT_UNFILTER:
if (cpu->gprs[0] < BASE_WORKING_RAM) { if (!(cpu->gprs[0] & 0x0E000000)) {
mLOG(GBA_BIOS, GAME_ERROR, "Bad UnFilter source"); mLOG(GBA_BIOS, GAME_ERROR, "Bad UnFilter source");
break; break;
} }