projects
/
dosdemo
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6e7bf38
)
fixed illegal access in bump.c
author
John Tsiombikas
<nuclear@mutantstargoat.com>
Sun, 2 Oct 2016 19:08:34 +0000
(22:08 +0300)
committer
John Tsiombikas
<nuclear@mutantstargoat.com>
Sun, 2 Oct 2016 19:08:34 +0000
(22:08 +0300)
src/bump.c
patch
|
blob
|
history
diff --git
a/src/bump.c
b/src/bump.c
index
228e141
..
dc53337
100644
(file)
--- 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;