2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-21 17:36:18 +01:00

Fix animation code accessing invalid sequence descriptor.

https://github.com/ValveSoftware/halflife/issues/3308
This commit is contained in:
Andrey Akhmichin 2022-11-26 02:27:38 +05:00
parent 1c80e4bbcd
commit 63e3769c46
No known key found for this signature in database
GPG Key ID: 1F180D249B0643C0

View File

@ -238,7 +238,7 @@ void GetSequenceInfo( void *pmodel, entvars_t *pev, float *pflFrameRate, float *
mstudioseqdesc_t *pseqdesc;
if( pev->sequence >= pstudiohdr->numseq )
if( pev->sequence < 0 || pev->sequence >= pstudiohdr->numseq )
{
*pflFrameRate = 0.0f;
*pflGroundSpeed = 0.0f;
@ -265,7 +265,7 @@ int GetSequenceFlags( void *pmodel, entvars_t *pev )
studiohdr_t *pstudiohdr;
pstudiohdr = (studiohdr_t *)pmodel;
if( !pstudiohdr || pev->sequence >= pstudiohdr->numseq )
if( !pstudiohdr || pev->sequence < 0 || pev->sequence >= pstudiohdr->numseq )
return 0;
mstudioseqdesc_t *pseqdesc;
@ -279,7 +279,7 @@ int GetAnimationEvent( void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEve
studiohdr_t *pstudiohdr;
pstudiohdr = (studiohdr_t *)pmodel;
if( !pstudiohdr || pev->sequence >= pstudiohdr->numseq || !pMonsterEvent )
if( !pstudiohdr || pev->sequence < 0 || pev->sequence >= pstudiohdr->numseq || !pMonsterEvent )
return 0;
mstudioseqdesc_t *pseqdesc;
@ -379,7 +379,7 @@ float SetBlending( void *pmodel, entvars_t *pev, int iBlender, float flValue )
studiohdr_t *pstudiohdr;
pstudiohdr = (studiohdr_t *)pmodel;
if( !pstudiohdr )
if( !pstudiohdr || pev->sequence < 0 || pev->sequence >= pstudiohdr->numseq )
return flValue;
mstudioseqdesc_t *pseqdesc;