From 353faed7825ba7ba293e0ce2afaac2d7b1f4da58 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Mon, 20 Nov 2017 19:26:04 -0500 Subject: [PATCH] Added x/y bounds checking to gfxGetFramebufferDisplayOffset(). --- nx/source/gfx/gfx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nx/source/gfx/gfx.c b/nx/source/gfx/gfx.c index d2db8c03..f1d7abad 100644 --- a/nx/source/gfx/gfx.c +++ b/nx/source/gfx/gfx.c @@ -249,6 +249,9 @@ u32 gfxGetFramebufferDisplayOffset(u32 x, u32 y) { gfxGetFramebuffer(&width, &height); + if (x >= width) x = width-1; + if (y >= height) y = height-1; + y = height-1-y; tilepos = ((y & 127) / 16) + (x/16*8) + ((y/16/8)*(width/16*8));