all repos — mgba @ b7947a0a6ec46a18efb1248612f32634b30c3f8d

mGBA Game Boy Advance Emulator

GBA BIOS: Add VBA LZ77 decompression bug compat in VBA bug compat mode
Vicki Pfau vi@endrift.com
Sat, 05 Dec 2020 16:27:39 -0800
commit

b7947a0a6ec46a18efb1248612f32634b30c3f8d

parent

63b17d20a9d1276c2ac17fdf6239d41b27f1dead

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

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

@@ -664,6 +664,13 @@ bytes = (block >> 12) + 3;

while (bytes--) { if (remaining) { --remaining; + } else { + mLOG(GBA_BIOS, GAME_ERROR, "Improperly compressed LZ77 data at %08X. " + "This will lead to a buffer overrun at %08X and may crash on hardware.", + cpu->gprs[0], cpu->gprs[1]); + if (gba->vbaBugCompat) { + break; + } } if (width == 2) { byte = (int16_t) cpu->memory.load16(cpu, disp & ~1, 0);