diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-11-29 18:31:50 +0200 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-11-29 18:31:50 +0200 |
commit | 74904f39e15961ada40221be418bbd758a5969ef (patch) | |
tree | ef973ca7c318d1bf6184947dce853379629f7dcd /indra/llrender/llrender.cpp | |
parent | 3b7a89322e5b0b3e177f4ea2faf5f061db17b37f (diff) |
SL-1130 Prevent crash on mMatrix
Diffstat (limited to 'indra/llrender/llrender.cpp')
-rw-r--r-- | indra/llrender/llrender.cpp | 8 |
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; } |