DS GX: Properly reject invalid commands
Vicki Pfau vi@endrift.com
Mon, 20 Jul 2020 08:47:19 -0700
2 files changed,
6 insertions(+),
0 deletions(-)
M
CHANGES
→
CHANGES
@@ -14,6 +14,7 @@ - DS I/O: Enable POWCNT1 bit 1 at boot (fixes mgba.io/i/616)
- DS Slot-1: Reply to IR 0x08 command properly (fixes mgba.io/i/666) - GBA Video: Fix mode 2 out-of-bounds VRAM crash - GBA Video: Fix regression adjusting brightness of backdrop + - DS GX: Properly reject invalid commands Misc: - DS GX: Clean up and unify texture mapping - DS Core: Add symbol loading
M
src/ds/gx.c
→
src/ds/gx.c
@@ -1437,6 +1437,10 @@ gx->outstandingParams[3] = 0;
gx->outstandingCommand[3] = 0; } } else { + if (entry.command >= DS_GX_CMD_MAX) { + mLOG(DS_GX, GAME_ERROR, "Wrote invalid command %02x to GX FIFO", entry.command); + return; + } gx->outstandingParams[0] = _gxCommandParams[entry.command]; if (gx->outstandingParams[0]) { --gx->outstandingParams[0];@@ -1447,6 +1451,7 @@ }
} uint32_t cycles = _gxCommandCycleBase[entry.command]; if (!cycles) { + mLOG(DS_GX, GAME_ERROR, "Wrote invalid command %02x to GX FIFO", entry.command); return; } if (CircleBufferSize(&gx->fifo) == 0 && CircleBufferSize(&gx->pipe) < (DS_GX_PIPE_SIZE * sizeof(entry))) {