MAINT-6729 Additional fix for crash in LLImageGL::analyzeAlpha()

meow-7.2.2
AndreyL ProductEngine 2016-12-08 17:21:05 +02:00
parent c84d307676
commit 99d76f85f9
3 changed files with 8 additions and 2 deletions

View File

@ -817,7 +817,7 @@ U8* LLImageBase::getData()
return mData;
}
bool LLImageBase::isBufferInvalid()
bool LLImageBase::isBufferInvalid() const
{
return mBadBufferAllocation || mData == NULL ;
}

View File

@ -141,7 +141,7 @@ public:
const U8 *getData() const ;
U8 *getData() ;
bool isBufferInvalid() ;
bool isBufferInvalid() const;
void setSize(S32 width, S32 height, S32 ncomponents);
U8* allocateDataSize(S32 width, S32 height, S32 ncomponents, S32 size = -1); // setSize() + allocateData()

View File

@ -1275,6 +1275,12 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S
llassert(gGLManager.mInited);
stop_glerror();
if (!imageraw || imageraw->isBufferInvalid())
{
LL_WARNS() << "Trying to create a texture from invalid image data" << LL_ENDL;
return FALSE;
}
if (discard_level < 0)
{
llassert(mCurrentDiscardLevel >= 0);