From: John Tsiombikas Date: Sun, 2 Oct 2016 19:08:34 +0000 (+0300) Subject: fixed illegal access in bump.c X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=commitdiff_plain;h=d00f30ccdcfe52d50a08b15748734b3503fae734 fixed illegal access in bump.c --- 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;