all repos — mgba @ 2688642f019e693fd8ebb84c5ef728a425a41cc6

mGBA Game Boy Advance Emulator

GBA BIOS: Fix HuffUnComp to work when games pass an invalid bit length
Jeffrey Pfau jeffrey@endrift.com
Tue, 13 Jan 2015 20:46:29 -0800
commit

2688642f019e693fd8ebb84c5ef728a425a41cc6

parent

cb14f00279d56ff22efa8bf9032b613418d88d68

2 files changed, 5 insertions(+), 0 deletions(-)

jump to
M CHANGESCHANGES

@@ -51,6 +51,7 @@ - Qt: Fix some cases where key mapping can break if focus is adjusted

- GBA Memory: Filter out top nybble of DMA addresses - Debugger: Fix binary print putting spaces between digits - GBA BIOS: Fix LZ77UnCompVram to use 16-bit loads from decompressed memory + - GBA BIOS: Fix HuffUnComp to work when games pass an invalid bit length Misc: - Qt: Disable sync to video by default - GBA: Exit cleanly on FATAL if the port supports it
M src/gba/gba-bios.csrc/gba/gba-bios.c

@@ -385,6 +385,10 @@ uint32_t dest = cpu->gprs[1];

uint32_t header = cpu->memory.load32(cpu, source, 0); int remaining = header >> 8; int bits = header & 0xF; + if (bits == 0) { + GBALog(gba, GBA_LOG_GAME_ERROR, "Invalid Huffman bits"); + bits = 8; + } if (32 % bits) { GBALog(gba, GBA_LOG_STUB, "Unimplemented unaligned Huffman"); return;