From 30cb4f1dcc4f55a6c09f471123d02a25fa2edd03 Mon Sep 17 00:00:00 2001 From: Sour Date: Wed, 20 Feb 2019 00:43:40 -0500 Subject: [PATCH] PPU: Fixed out-of-bounds memory writes --- Core/Ppu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Ppu.cpp b/Core/Ppu.cpp index e74d99a..77d2471 100644 --- a/Core/Ppu.cpp +++ b/Core/Ppu.cpp @@ -296,7 +296,7 @@ void Ppu::RenderScanline() uint8_t row = (info.TileRow + rowOffset) & 0x0F; constexpr uint16_t bpp = 4; - for(int x = info.X; x < info.X + width; x++) { + for(int x = info.X; x > 0 && x < info.X + width && x < 256; x++) { if(_spritePixels[x] == 0xFFFF) { uint8_t xOffset; int columnOffset;