mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-10 22:22:10 +08:00
engine: client: fix out of bound read in gamma table access functions
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user