Fix animation code accessing invalid sequence descriptor.

https://github.com/ValveSoftware/halflife/issues/3308
pull/278/merge
Andrey Akhmichin 2 months ago
parent 1c80e4bbcd
commit 63e3769c46
No known key found for this signature in database
GPG Key ID: 1F180D249B0643C0
  1. 8
      dlls/animation.cpp

@ -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;

Loading…
Cancel
Save