summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-11-29 18:31:50 +0200
committerandreykproductengine <andreykproductengine@lindenlab.com>2019-11-29 18:31:50 +0200
commit74904f39e15961ada40221be418bbd758a5969ef (patch)
treeef973ca7c318d1bf6184947dce853379629f7dcd /indra
parent3b7a89322e5b0b3e177f4ea2faf5f061db17b37f (diff)
SL-1130 Prevent crash on mMatrix
Diffstat (limited to 'indra')
-rw-r--r--indra/llrender/llrender.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 65d6181920..5bcccb35af 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -1458,9 +1458,15 @@ void LLRender::matrixMode(U32 mode)
if (mode == MM_TEXTURE)
{
mode = MM_TEXTURE0 + gGL.getCurrentTexUnitIndex();
+ if (mode > MM_TEXTURE3)
+ {
+ // getCurrentTexUnitIndex() can go as high as 32 (LL_NUM_TEXTURE_LAYERS)
+ // Large value will result in a crash at mMatrix
+ LL_WARNS_ONCE() << "Attempted to assign matrix mode out of bounds: " << mode << LL_ENDL;
+ mode = MM_TEXTURE0;
+ }
}
- llassert(mode < NUM_MATRIX_MODES);
mMatrixMode = mode;
}