From 5dda65c0303d0e3c38e4ab57c26759937af0eeb2 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 15 Apr 2010 20:15:40 +0100 Subject: EXT-4388 Crash in octree line segment intersection code (getMask) Add yet more paranoia-and-return-or-assert, this time for +-INF in input vector. To be reviewed by Bao. (transplanted from 2012f21d23c66179345fb26148cfbe19835b325e) --- indra/llmath/v2math.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/llmath/v2math.h') diff --git a/indra/llmath/v2math.h b/indra/llmath/v2math.h index 9fef8851cc..65f3714313 100644 --- a/indra/llmath/v2math.h +++ b/indra/llmath/v2math.h @@ -70,6 +70,8 @@ class LLVector2 void setVec(const LLVector2 &vec); // deprecated void setVec(const F32 *vec); // deprecated + inline bool isFinite() const; // checks to see if all values of LLVector2 are finite + F32 length() const; // Returns magnitude of LLVector2 F32 lengthSquared() const; // Returns magnitude squared of LLVector2 F32 normalize(); // Normalizes and returns the magnitude of LLVector2 @@ -215,6 +217,7 @@ inline void LLVector2::setVec(const F32 *vec) mV[VY] = vec[VY]; } + // LLVector2 Magnitude and Normalization Functions inline F32 LLVector2::length(void) const @@ -247,6 +250,12 @@ inline F32 LLVector2::normalize(void) return (mag); } +// checker +inline bool LLVector2::isFinite() const +{ + return (llfinite(mV[VX]) && llfinite(mV[VY])); +} + // deprecated inline F32 LLVector2::magVec(void) const { -- cgit v1.2.3