all repos — mgba @ 0b0739f56754a4603f6e4a3396d65e80a26fc3ca

mGBA Game Boy Advance Emulator

DS GX: Properly reject invalid commands
Vicki Pfau vi@endrift.com
Mon, 20 Jul 2020 08:47:19 -0700
commit

0b0739f56754a4603f6e4a3396d65e80a26fc3ca

parent

2b4a4b5ab6586b9cc1699b33ee05de8564d621da

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

jump to
M CHANGESCHANGES

@@ -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.csrc/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))) {