GBA BIOS: Add warning for LZ77 error causing BIOS to hang (closes #879)
Vicki Pfau vi@endrift.com
Thu, 16 Nov 2017 09:22:15 -0800
1 files changed,
5 insertions(+),
1 deletions(-)
jump to
M
src/gba/bios.c
→
src/gba/bios.c
@@ -529,7 +529,11 @@ int block = cpu->memory.load8(cpu, source + 1, 0) | (cpu->memory.load8(cpu, source, 0) << 8);
source += 2; disp = dest - (block & 0x0FFF) - 1; bytes = (block >> 12) + 3; - while (bytes-- && remaining) { + while (bytes--) { + if (!remaining) { + mLOG(GBA_BIOS, GAME_ERROR, "Improperly compressed LZ77 data. Real BIOS would hang."); + break; + } --remaining; if (width == 2) { byte = (int16_t) cpu->memory.load16(cpu, disp & ~1, 0);