-
-
Save Zeno-/86d2cd841c0af2d03651 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From: Craig Robbins <kde.psych@gmail.com> | |
Date: Fri, 16 Jan 2015 14:32:27 +1000 | |
Subject: [PATCH] Fix potential out-of-bounds array index | |
--- | |
src/mapblock_mesh.cpp | 6 +++--- | |
1 file changed, 3 insertions(+), 3 deletions(-) | |
diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp | |
index 8afca73..cf311ac 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); | |
-- | |
1.9.3 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment