From 918612fa238355d01bfdef15e970de2f67695b81 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 4 Jul 2023 01:39:26 +0700 Subject: [PATCH] GetBonePosition: Added bone index bounds check --- rehlds/engine/r_studio.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rehlds/engine/r_studio.cpp b/rehlds/engine/r_studio.cpp index 906c205a..4124bf67 100644 --- a/rehlds/engine/r_studio.cpp +++ b/rehlds/engine/r_studio.cpp @@ -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,