Skip to content
Snippets Groups Projects
Commit 74904f39 authored by andreykproductengine's avatar andreykproductengine
Browse files

SL-1130 Prevent crash on mMatrix

parent 3b7a8932
No related branches found
No related tags found
No related merge requests found
...@@ -1458,9 +1458,15 @@ void LLRender::matrixMode(U32 mode) ...@@ -1458,9 +1458,15 @@ void LLRender::matrixMode(U32 mode)
if (mode == MM_TEXTURE) if (mode == MM_TEXTURE)
{ {
mode = MM_TEXTURE0 + gGL.getCurrentTexUnitIndex(); 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; mMatrixMode = mode;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment