summaryrefslogtreecommitdiff
path: root/indra/llimage/llimagetga.cpp
diff options
context:
space:
mode:
authorruslantproductengine <ruslantproductengine@lindenlab.com>2015-08-04 17:51:58 +0300
committerruslantproductengine <ruslantproductengine@lindenlab.com>2015-08-04 17:51:58 +0300
commitff3e1ae7d6c12574fca820fa4f24ceca1d8158e6 (patch)
tree929bdbcb6b49bc0c2377597cbe78e9b31d1abcc3 /indra/llimage/llimagetga.cpp
parent1764ac934953b767da7ab727e3f0677e5f7568e9 (diff)
MAINT-5343 (Viewer sometimes crashes when updating a local tga texture when RLE or BMP compression is disabled - LLImageTGA::decodeTruecolorNonRle)
Diffstat (limited to 'indra/llimage/llimagetga.cpp')
-rwxr-xr-xindra/llimage/llimagetga.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/indra/llimage/llimagetga.cpp b/indra/llimage/llimagetga.cpp
index 4eb8dc7440..d0ae105ba7 100755
--- a/indra/llimage/llimagetga.cpp
+++ b/indra/llimage/llimagetga.cpp
@@ -437,7 +437,13 @@ BOOL LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, BOOL &alpha_opaqu
// Origin is the bottom left
U8* dst = raw_image->getData();
U8* src = getData() + mDataOffset;
+
S32 pixels = getWidth() * getHeight();
+
+ if (pixels * (mIs15Bit ? 2 : getComponents()) > getDataSize() - mDataOffset)
+ { //here we have situation when data size in src less than actually needed
+ return FALSE;
+ }
if (getComponents() == 4)
{