mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
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:
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user