summaryrefslogtreecommitdiff
path: root/indra/newview/llvopartgroup.cpp
diff options
context:
space:
mode:
authorGraham Madarasz <graham@lindenlab.com>2013-06-12 09:16:19 -0700
committerGraham Madarasz <graham@lindenlab.com>2013-06-12 09:16:19 -0700
commitd2b253f1f6072beead770519849ad3b18a1a4359 (patch)
treec50dcc7ea602746d156e24a9127721a95f640007 /indra/newview/llvopartgroup.cpp
parent48324a93833cee8aca7559588ee5f2b4afa250fa (diff)
Changes to protect against use of normalize3fast on degenerate vectors
Diffstat (limited to 'indra/newview/llvopartgroup.cpp')
-rwxr-xr-xindra/newview/llvopartgroup.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp
index 6a7f26bdb5..b25213d85f 100755
--- a/indra/newview/llvopartgroup.cpp
+++ b/indra/newview/llvopartgroup.cpp
@@ -411,14 +411,21 @@ void LLVOPartGroup::getGeometry(S32 idx,
LLVector4a right;
right.setCross3(at, up);
+ // guard against NaNs in normalize below
+ llassert(right.dot3(right).getF32() > F_APPROXIMATELY_ZERO);
right.normalize3fast();
+
up.setCross3(right, at);
+ // guard against NaNs in normalize below
+ llassert(up.dot3(up).getF32() > F_APPROXIMATELY_ZERO);
up.normalize3fast();
if (part.mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK)
{
LLVector4a normvel;
normvel.load3(part.mVelocity.mV);
+ // guard against NaNs in normalize below
+ llassert(normvel.dot3(normvel).getF32() > F_APPROXIMATELY_ZERO);
normvel.normalize3fast();
LLVector2 up_fracs;
up_fracs.mV[0] = normvel.dot3(right).getF32();
@@ -443,6 +450,9 @@ void LLVOPartGroup::getGeometry(S32 idx,
up = new_up;
right = t;
+ // guard against NaNs in normalize below
+ llassert(up.dot3(up).getF32() > F_APPROXIMATELY_ZERO);
+ llassert(right.dot3(right).getF32() > F_APPROXIMATELY_ZERO);
up.normalize3fast();
right.normalize3fast();
}