2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-22 01:45:19 +01:00

engine: client: fix out of bound read in gamma table access functions

This commit is contained in:
Alibek Omarov 2024-11-02 22:13:46 +03:00
parent 8af995cc28
commit 1f49ce599f

View File

@ -196,7 +196,7 @@ uint LightToTexGammaEx( uint b )
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
return b;
if( unlikely( b > ARRAYSIZE( lightgammatable )))
if( unlikely( b >= ARRAYSIZE( lightgammatable )))
return 0;
return lightgammatable[b];
@ -207,7 +207,7 @@ uint ScreenGammaTable( uint b )
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
return b;
if( unlikely( b > ARRAYSIZE( screengammatable )))
if( unlikely( b >= ARRAYSIZE( screengammatable )))
return 0;
return screengammatable[b];
@ -218,7 +218,7 @@ uint LinearGammaTable( uint b )
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
return b;
if( unlikely( b > ARRAYSIZE( lineargammatable )))
if( unlikely( b >= ARRAYSIZE( lineargammatable )))
return 0;
return lineargammatable[b];
}