#4527 Crash trying to upload a huge image
Raw image permits only a 256 MB buffer so this isn't unexpected.master
parent
922d2324d0
commit
82e6e42b9e
|
|
@ -558,6 +558,12 @@ bool LLImageBMP::encode(const LLImageRaw* raw_image, F32 encode_time)
|
|||
LL_INFOS() << "Dropping alpha information during BMP encoding" << LL_ENDL;
|
||||
}
|
||||
|
||||
if (raw_image->isBufferInvalid())
|
||||
{
|
||||
setLastError("Invalid input, no buffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
setSize(raw_image->getWidth(), raw_image->getHeight(), dst_components);
|
||||
|
||||
U8 magic[14];
|
||||
|
|
|
|||
|
|
@ -329,6 +329,12 @@ bool LLImageDXT::encodeDXT(const LLImageRaw* raw_image, F32 time, bool explicit_
|
|||
{
|
||||
llassert_always(raw_image);
|
||||
|
||||
if (raw_image->isBufferInvalid())
|
||||
{
|
||||
setLastError("Invalid input, no buffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
S32 ncomponents = raw_image->getComponents();
|
||||
EFileFormat format;
|
||||
switch (ncomponents)
|
||||
|
|
|
|||
|
|
@ -491,6 +491,12 @@ bool LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time )
|
|||
|
||||
resetLastError();
|
||||
|
||||
if (raw_image->isBufferInvalid())
|
||||
{
|
||||
setLastError("Invalid input, no buffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
LLImageDataSharedLock lockIn(raw_image);
|
||||
LLImageDataLock lockOut(this);
|
||||
|
||||
|
|
|
|||
|
|
@ -897,6 +897,12 @@ bool LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod
|
|||
|
||||
bool LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time, bool reversible)
|
||||
{
|
||||
if (raw_image.isBufferInvalid())
|
||||
{
|
||||
base.setLastError("Invalid input, no buffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
JPEG2KEncode encode(comment_text, reversible);
|
||||
bool encoded = encode.encode(raw_image, base);
|
||||
if (!encoded)
|
||||
|
|
|
|||
|
|
@ -662,6 +662,12 @@ bool LLImageJ2CKDU::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, co
|
|||
bool vflip = true;
|
||||
bool hflip = false;
|
||||
|
||||
if (raw_image.isBufferInvalid())
|
||||
{
|
||||
base.setLastError("Invalid input, no buffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Set up input image files
|
||||
|
|
|
|||
|
|
@ -288,7 +288,9 @@ void LLFloaterImagePreview::onBtnOK()
|
|||
}
|
||||
else
|
||||
{
|
||||
LLNotificationsUtil::add("ErrorEncodingImage");
|
||||
LLSD args;
|
||||
args["REASON"] = LLImage::getLastThreadError();
|
||||
LLNotificationsUtil::add("ErrorEncodingImage", args);
|
||||
LL_WARNS() << "Error encoding image" << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1320,6 +1320,14 @@ Error encoding snapshot.
|
|||
<tag>fail</tag>
|
||||
</notification>
|
||||
|
||||
<notification
|
||||
icon="alertmodal.tga"
|
||||
name="ErrorEncodingImage"
|
||||
type="alertmodal">
|
||||
Failed to encode image, reason: [REASON]
|
||||
<tag>fail</tag>
|
||||
</notification>
|
||||
|
||||
<notification
|
||||
icon="alertmodal.tga"
|
||||
name="ErrorTextureCannotAfford"
|
||||
|
|
|
|||
Loading…
Reference in New Issue