From d00f30ccdcfe52d50a08b15748734b3503fae734 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Sun, 2 Oct 2016 22:08:34 +0300 Subject: [PATCH] fixed illegal access in bump.c --- src/bump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bump.c b/src/bump.c index 228e141..dc53337 100644 --- a/src/bump.c +++ b/src/bump.c @@ -91,8 +91,8 @@ static int init(void) const float offsetPower = 2.0f; int dx, dy, xp, yp; - dx = (int)((heightmap[i] - heightmap[i + 1]) * offsetPower); - dy = (int)((heightmap[i] - heightmap[i + fb_width]) * offsetPower); + dx = i < fb_size - 1 ? (int)((heightmap[i] - heightmap[i + 1]) * offsetPower) : 0; + dy = i < fb_size - fb_width ? (int)((heightmap[i] - heightmap[i + fb_width]) * offsetPower) : 0; xp = x + dx; if (xp < 0) xp = 0; -- 1.7.10.4