Skip to content

Commit

Permalink
GetBonePosition: Added bone index bounds check
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Jul 3, 2023
1 parent 8841ba4 commit 918612f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rehlds/engine/r_studio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,15 @@ void EXT_FUNC AnimationAutomove(const edict_t *pEdict, float flTime)
void EXT_FUNC GetBonePosition(const edict_t *pEdict, int iBone, float *rgflOrigin, float *rgflAngles)
{
pstudiohdr = (studiohdr_t *)Mod_Extradata(g_psv.models[pEdict->v.modelindex]);

#ifdef REHLDS_FIXES
if (!pstudiohdr)
return;

if (iBone < 0 || iBone >= pstudiohdr->numbones)
return; // invalid bone
#endif

g_pSvBlendingAPI->SV_StudioSetupBones(
g_psv.models[pEdict->v.modelindex],
pEdict->v.frame,
Expand Down

0 comments on commit 918612f

Please sign in to comment.