From 1f49ce599faecab71728754028ec066530d3018c Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 2 Nov 2024 22:13:46 +0300 Subject: [PATCH] engine: client: fix out of bound read in gamma table access functions --- engine/client/gamma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/client/gamma.c b/engine/client/gamma.c index 3cce4d85..f23308ad 100644 --- a/engine/client/gamma.c +++ b/engine/client/gamma.c @@ -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]; }