summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-01-20 15:59:26 -0800
committerTofu Linden <tofu.linden@lindenlab.com>2010-01-20 15:59:26 -0800
commit417f0ede41d1dcfed45ae56f515f2ea6d63e599f (patch)
tree8d64421543c9b1e3b1f90742c413fd1bf9451472 /indra/llrender
parent56f97bce04c6b14460aba207108b06a67040c4d9 (diff)
EXT-4388 Crash in octree line segment intersection code
(more accurately, it was - I believe - reading over the end of a buffer in the pick-mask lookup) reviewed by qarl.
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llimagegl.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index d873005fd9..cd493481d5 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1736,12 +1736,25 @@ BOOL LLImageGL::getMask(const LLVector2 &tc)
if (u < 0.f || u > 1.f ||
v < 0.f || v > 1.f)
{
- llerrs << "WTF?" << llendl;
+ LL_WARNS_ONCE("render") << "Ugh, u/v out of range in image mask pick" << LL_ENDL;
+ u = v = 0.f;
+ llassert(false);
}
S32 x = (S32)(u * width);
S32 y = (S32)(v * height);
+ if (x >= width)
+ {
+ LL_WARNS_ONCE("render") << "Ooh, width overrun on pick mask read, that coulda been bad." << LL_ENDL;
+ x = llmax(0, width-1);
+ }
+ if (y >= height)
+ {
+ LL_WARNS_ONCE("render") << "Ooh, height overrun on pick mask read, that woulda been bad." << LL_ENDL;
+ y = llmax(0, height-1);
+ }
+
S32 idx = y*width+x;
S32 offset = idx%8;