ref: gl: fix out of bounds access

On GPUs where GL_ARB_shading_language_100 isn't available (i.e. all mobile GPUs
I believe) this function would return total amount of texture units available.

But ref_gl only tracks and uses MAX_TEXTURE_UNITS texture units, causing memory
corruption in functions that doesn't check the limit.
This commit is contained in:
Alibek Omarov
2025-10-17 09:17:47 +05:00
parent 9330e44817
commit 7a02110a42

View File

@@ -764,7 +764,7 @@ static inline int GL_MaxTextureUnits( void )
{
if( GL_Support( GL_SHADER_GLSL100_EXT ))
return Q_min( Q_max( glConfig.max_texture_coords, glConfig.max_teximage_units ), MAX_TEXTURE_UNITS );
return glConfig.max_texture_units;
return Q_min( glConfig.max_texture_units, MAX_TEXTURE_UNITS );
}
#define WORLDMODEL (gp_cl->models[1])