mirror of
https://github.com/rehlds/rehlds.git
synced 2025-04-09 11:00:08 +03:00
GetAttachment: Added attachment index bounds check
This commit is contained in:
parent
0c5ce53666
commit
8841ba4aec
@ -906,14 +906,23 @@ void EXT_FUNC GetAttachment(const edict_t *pEdict, int iAttachment, float *rgflO
|
|||||||
mstudioattachment_t *pattachment;
|
mstudioattachment_t *pattachment;
|
||||||
vec3_t angles;
|
vec3_t angles;
|
||||||
|
|
||||||
|
pstudiohdr = (studiohdr_t *)Mod_Extradata(g_psv.models[pEdict->v.modelindex]);
|
||||||
|
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
if (!pstudiohdr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (iAttachment < 0 || iAttachment >= pstudiohdr->numattachments)
|
||||||
|
return; // invalid attachment
|
||||||
|
#endif
|
||||||
|
|
||||||
|
pattachment = (mstudioattachment_t *)((char *)pstudiohdr + pstudiohdr->attachmentindex);
|
||||||
|
pattachment += iAttachment;
|
||||||
|
|
||||||
angles[0] = -pEdict->v.angles[0];
|
angles[0] = -pEdict->v.angles[0];
|
||||||
angles[1] = pEdict->v.angles[1];
|
angles[1] = pEdict->v.angles[1];
|
||||||
angles[2] = pEdict->v.angles[2];
|
angles[2] = pEdict->v.angles[2];
|
||||||
|
|
||||||
pstudiohdr = (studiohdr_t *)Mod_Extradata(g_psv.models[pEdict->v.modelindex]);
|
|
||||||
pattachment = (mstudioattachment_t *)((char *)pstudiohdr + pstudiohdr->attachmentindex);
|
|
||||||
pattachment += iAttachment;
|
|
||||||
|
|
||||||
g_pSvBlendingAPI->SV_StudioSetupBones(
|
g_pSvBlendingAPI->SV_StudioSetupBones(
|
||||||
g_psv.models[pEdict->v.modelindex],
|
g_psv.models[pEdict->v.modelindex],
|
||||||
pEdict->v.frame,
|
pEdict->v.frame,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user