all repos — mgba @ caf59d726f5e8e4b9269e7ada8bc9c59831b08bb

mGBA Game Boy Advance Emulator

GBA Video: mVL bounds checking
Vicki Pfau vi@endrift.com
Tue, 18 Apr 2017 03:42:37 -0700
commit

caf59d726f5e8e4b9269e7ada8bc9c59831b08bb

parent

5b6bf9eb646b10b55424c4112e77295163894dfe

1 files changed, 15 insertions(+), 7 deletions(-)

jump to
M src/gba/renderers/proxy.csrc/gba/renderers/proxy.c

@@ -130,19 +130,27 @@ case DIRTY_REGISTER:

proxyRenderer->backend->writeVideoRegister(proxyRenderer->backend, item->address, item->value); break; case DIRTY_PALETTE: - logger->palette[item->address >> 1] = item->value; - proxyRenderer->backend->writePalette(proxyRenderer->backend, item->address, item->value); + if (item->address < SIZE_PALETTE_RAM) { + logger->palette[item->address >> 1] = item->value; + proxyRenderer->backend->writePalette(proxyRenderer->backend, item->address, item->value); + } break; case DIRTY_OAM: - logger->oam[item->address] = item->value; - proxyRenderer->backend->writeOAM(proxyRenderer->backend, item->address); + if (item->address < SIZE_PALETTE_RAM) { + logger->oam[item->address] = item->value; + proxyRenderer->backend->writeOAM(proxyRenderer->backend, item->address); + } break; case DIRTY_VRAM: - logger->readData(logger, &logger->vram[item->address >> 1], 0x1000, true); - proxyRenderer->backend->writeVRAM(proxyRenderer->backend, item->address); + if (item->address + 0x1000 <= SIZE_VRAM) { + logger->readData(logger, &logger->vram[item->address >> 1], 0x1000, true); + proxyRenderer->backend->writeVRAM(proxyRenderer->backend, item->address); + } break; case DIRTY_SCANLINE: - proxyRenderer->backend->drawScanline(proxyRenderer->backend, item->address); + if (item->address < VIDEO_VERTICAL_PIXELS) { + proxyRenderer->backend->drawScanline(proxyRenderer->backend, item->address); + } break; case DIRTY_FRAME: proxyRenderer->backend->finishFrame(proxyRenderer->backend);