Fix buffer overflow in SetGamma when using an undefined gamma ramp

stable-5.2
Günther Brammer 2009-08-12 19:55:51 +02:00
parent 7621c97b92
commit 2f505e2bc2
1 changed files with 1 additions and 0 deletions

View File

@ -828,6 +828,7 @@ void C4GraphicsSystem::SetGamma(DWORD dwClr1, DWORD dwClr2, DWORD dwClr3, int32_
{
// No gamma effects
if (Config.Graphics.DisableGamma) return;
if (iRampIndex < 0 || iRampIndex >= C4MaxGammaRamps) return;
// turn ramp index into array offset
iRampIndex*=3;
// set array members