diff --git a/src/gba/bios.c b/src/gba/bios.c index e71be63e2..8dd28f197 100644 --- a/src/gba/bios.c +++ b/src/gba/bios.c @@ -664,6 +664,13 @@ static void _unLz77(struct GBA* gba, int width) { 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);