aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Robbins <kde.psych@gmail.com>2015-01-16 14:32:27 +1000
committerCraig Robbins <kde.psych@gmail.com>2015-01-16 14:35:57 +1000
commit5e58a954910d9a9a3368bee71ab3aa0b3baf7c3a (patch)
treeda96d9f55e267c18aa5ac73f3428f804464b3473
parent5aeeb219e3fc2f37d3996a3df3b660afcc5f7599 (diff)
downloadminetest-5e58a954910d9a9a3368bee71ab3aa0b3baf7c3a.tar.gz
minetest-5e58a954910d9a9a3368bee71ab3aa0b3baf7c3a.tar.bz2
minetest-5e58a954910d9a9a3368bee71ab3aa0b3baf7c3a.zip
Fix potential out-of-bounds array index
-rw-r--r--src/mapblock_mesh.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp
index 8afca73a5..cf311acba 100644
--- a/src/mapblock_mesh.cpp
+++ b/src/mapblock_mesh.cpp
@@ -346,15 +346,15 @@ void finalColorBlend(video::SColor& result,
1, 4, 6, 6, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
- b += emphase_blue_when_dark[b / 8];
- b = irr::core::clamp (b, 0, 255);
+ b += emphase_blue_when_dark[irr::core::clamp(b, 0, 255) / 8];
+ b = irr::core::clamp(b, 0, 255);
// Artificial light is yellow-ish
static const u8 emphase_yellow_when_artificial[16] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 10, 15, 15, 15
};
rg += emphase_yellow_when_artificial[night/16];
- rg = irr::core::clamp (rg, 0, 255);
+ rg = irr::core::clamp(rg, 0, 255);
result.setRed(rg);
result.setGreen(rg);