From b4cd4a27bfeea91381aafff602474dfbea0a6f80 Mon Sep 17 00:00:00 2001 From: Beq Date: Mon, 8 Jun 2020 12:24:48 +0100 Subject: [PATCH] make fix for FIRE-29679 more general this revokes previous changes in llface.cpp and moves them lower down the stack so that the additional safety check appliesto call callers. --- indra/llrender/llvertexbuffer.cpp | 8 ++++++++ indra/newview/llface.cpp | 9 +-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index b31fb2d6ef..ce3aab8c2b 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -698,6 +698,14 @@ void LLVertexBuffer::drawElements(U32 mode, const S32 num_vertices, const LLVect // { llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); + + // FIRE-29679 trap empty calls that cause crashes when rezzing in OpenSim. + if(pos == nullptr || indicesp == nullptr ) + { + LL_WARNS() << "Called drawElements with null pos or null indices" << LL_ENDL; + return; + } + // // Crash fix due to invalid calls to drawElements by Drake Arconis if (num_vertices <= 0) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 30a57232dd..d780afd596 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -658,14 +658,7 @@ void renderFace(LLDrawable* drawable, LLFace *face) const LLVolumeFace& vol_face = volume->getVolumeFace(face->getTEOffset()); // Use a vbo for the static LLVertexBuffer::drawArray/Element functions; by Drake Arconis/Shyotl Kuhr //LLVertexBuffer::drawElements(LLRender::TRIANGLES, vol_face.mPositions, NULL, vol_face.mNumIndices, vol_face.mIndices); - // FIRE-29679 trap empty calls that cause crashes when rezzing in OpenSim. - // Note: the drawElements() call checks for 0 length but in this case the number is non-zero but pointer is null. - // LLVertexBuffer::drawElements(LLRender::TRIANGLES, vol_face.mNumVertices, vol_face.mPositions, NULL, vol_face.mNumIndices, vol_face.mIndices); - if (vol_face.mIndices != nullptr && vol_face.mPositions != nullptr) - { - LLVertexBuffer::drawElements(LLRender::TRIANGLES, vol_face.mNumVertices, vol_face.mPositions, NULL, vol_face.mNumIndices, vol_face.mIndices); - } - // + LLVertexBuffer::drawElements(LLRender::TRIANGLES, vol_face.mNumVertices, vol_face.mPositions, NULL, vol_face.mNumIndices, vol_face.mIndices); } } }