Skip to content
Snippets Groups Projects
Commit 5e58a954 authored by Zeno-'s avatar Zeno-
Browse files

Fix potential out-of-bounds array index

parent 5aeeb219
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment