From c06edae71d8a236124f3068700db1204b8473af1 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Tue, 30 Aug 2016 00:44:34 -0700 Subject: [PATCH] GB: Fix boundary condition at end of scanline rendering --- src/gb/renderers/software.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gb/renderers/software.c b/src/gb/renderers/software.c index 3ef56087a..f08b69e69 100644 --- a/src/gb/renderers/software.c +++ b/src/gb/renderers/software.c @@ -133,7 +133,7 @@ static void GBVideoSoftwareRendererDrawRange(struct GBVideoRenderer* renderer, i } color_t* row = &softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * y]; int x; - for (x = startX; x < (endX & ~7); x += 8) { + for (x = startX; x + 7 < (endX & ~7); x += 8) { row[x] = softwareRenderer->palette[softwareRenderer->row[x] & 0x7F]; row[x + 1] = softwareRenderer->palette[softwareRenderer->row[x + 1] & 0x7F]; row[x + 2] = softwareRenderer->palette[softwareRenderer->row[x + 2] & 0x7F];