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.
meow-7.2.2
Beq 2020-06-08 12:24:48 +01:00
parent e864a3379b
commit b4cd4a27bf
2 changed files with 9 additions and 8 deletions

View File

@ -698,6 +698,14 @@ void LLVertexBuffer::drawElements(U32 mode, const S32 num_vertices, const LLVect
// </FS:Ansariel>
{
llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
// <FS:Beq> 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;
}
// </FS:Beq>
// <FS:Ansariel> Crash fix due to invalid calls to drawElements by Drake Arconis
if (num_vertices <= 0)

View File

@ -658,14 +658,7 @@ void renderFace(LLDrawable* drawable, LLFace *face)
const LLVolumeFace& vol_face = volume->getVolumeFace(face->getTEOffset());
// <FS:Ansariel> 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);
// <FS:Beq> 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);
}
// </FS:Beq>
LLVertexBuffer::drawElements(LLRender::TRIANGLES, vol_face.mNumVertices, vol_face.mPositions, NULL, vol_face.mNumIndices, vol_face.mIndices);
}
}
}