From a77344516ce00ed7b447626c1d57195dd183b7f9 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 5 Feb 2019 21:38:00 +0000 Subject: SL-10471 - animation validation for constraints --- indra/llappearance/llavatarappearance.cpp | 2 +- indra/llcharacter/llkeyframemotion.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index 92217c60ff..c28b5f8081 100644 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -1350,7 +1350,7 @@ LLVector3 LLAvatarAppearance::getVolumePos(S32 joint_index, LLVector3& volume_of //----------------------------------------------------------------------------- LLJoint* LLAvatarAppearance::findCollisionVolume(U32 volume_id) { - if ((S32)volume_id > mNumCollisionVolumes) + if (((S32)volume_id >= mNumCollisionVolumes) || ((S32)volume_id < 0)) { return NULL; } diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index 330d812985..5d323ed5d6 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -1772,6 +1772,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id) bin_data[BIN_DATA_LENGTH] = 0; // Ensure null termination str = (char*)bin_data; constraintp->mSourceConstraintVolume = mCharacter->getCollisionVolumeID(str); + if (constraintp->mSourceConstraintVolume == -1) + { + LL_WARNS() << "not a valid source constraint volume " << str + << " for animation " << asset_id << LL_ENDL; + delete constraintp; + return FALSE; + } if (!dp.unpackVector3(constraintp->mSourceConstraintOffset, "source_offset")) { @@ -1808,6 +1815,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id) { constraintp->mConstraintTargetType = CONSTRAINT_TARGET_TYPE_BODY; constraintp->mTargetConstraintVolume = mCharacter->getCollisionVolumeID(str); + if (constraintp->mTargetConstraintVolume == -1) + { + LL_WARNS() << "not a valid target constraint volume " << str + << " for animation " << asset_id << LL_ENDL; + delete constraintp; + return FALSE; + } } if (!dp.unpackVector3(constraintp->mTargetConstraintOffset, "target_offset")) -- cgit v1.2.3