mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-21 09:25:45 +01:00
ref: fix some possible off by one errors
This commit is contained in:
parent
8fd5a5af96
commit
046b1da8a8
@ -229,7 +229,7 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
|
||||
VectorAdd( verts[0], delta, verts[2] );
|
||||
VectorAdd( verts[1], delta, verts[3] );
|
||||
|
||||
if( p->color < 0 || p->color > sizeof( gTracerColors ) / sizeof( gTracerColors[0] ))
|
||||
if( p->color < 0 || p->color >= sizeof( gTracerColors ) / sizeof( gTracerColors[0] ))
|
||||
{
|
||||
p->color = TRACER_COLORINDEX_DEFAULT;
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ int TriSpriteTexture( model_t *pSpriteModel, int frame )
|
||||
if(( gl_texturenum = R_GetSpriteTexture( pSpriteModel, frame )) == 0 )
|
||||
return 0;
|
||||
|
||||
if( gl_texturenum <= 0 || gl_texturenum > MAX_TEXTURES )
|
||||
if( gl_texturenum <= 0 || gl_texturenum >= MAX_TEXTURES )
|
||||
gl_texturenum = tr.defaultTexture;
|
||||
|
||||
GL_Bind( XASH_TEXTURE0, gl_texturenum );
|
||||
|
@ -240,7 +240,7 @@ void GAME_EXPORT CL_DrawTracers( double frametime, particle_t *cl_active_tracers
|
||||
VectorAdd( verts[0], delta, verts[2] );
|
||||
VectorAdd( verts[1], delta, verts[3] );
|
||||
|
||||
if( p->color < 0 || p->color > sizeof( gTracerColors ) / sizeof( gTracerColors[0] ))
|
||||
if( p->color < 0 || p->color >= sizeof( gTracerColors ) / sizeof( gTracerColors[0] ))
|
||||
{
|
||||
p->color = TRACER_COLORINDEX_DEFAULT;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ static void R_EmitEdge( mvertex_t *pv0, mvertex_t *pv1 )
|
||||
v = ceilv0;
|
||||
v2 = r_ceilv1 - 1;
|
||||
|
||||
if( v < 0 || v > MAXHEIGHT )
|
||||
if( v < 0 || v >= MAXHEIGHT )
|
||||
{
|
||||
gEngfuncs.Con_Printf( S_ERROR "trailing edge overflow : %d\n", v );
|
||||
return;
|
||||
@ -242,7 +242,7 @@ static void R_EmitEdge( mvertex_t *pv0, mvertex_t *pv1 )
|
||||
v2 = ceilv0 - 1;
|
||||
v = r_ceilv1;
|
||||
|
||||
if( v < 0 || v > MAXHEIGHT )
|
||||
if( v < 0 || v >= MAXHEIGHT )
|
||||
{
|
||||
gEngfuncs.Con_Printf( S_ERROR "leading edge overflow : %d\n", v );
|
||||
return;
|
||||
|
@ -289,7 +289,7 @@ int TriSpriteTexture( model_t *pSpriteModel, int frame )
|
||||
if(( gl_texturenum = R_GetSpriteTexture( pSpriteModel, frame )) == 0 )
|
||||
return 0;
|
||||
|
||||
if( gl_texturenum <= 0 || gl_texturenum > MAX_TEXTURES )
|
||||
if( gl_texturenum <= 0 || gl_texturenum >= MAX_TEXTURES )
|
||||
gl_texturenum = tr.defaultTexture;
|
||||
|
||||
GL_Bind( XASH_TEXTURE0, gl_texturenum );
|
||||
|
Loading…
Reference in New Issue
Block a user