diff options
author | Rye Cogtail <rye@lindenlab.com> | 2024-10-30 15:29:59 -0400 |
---|---|---|
committer | Rye <rye@lindenlab.com> | 2024-10-30 22:08:06 -0700 |
commit | b44158591b06704de6506d4ec03314e93c800adb (patch) | |
tree | e2f0e220597761477eeac92d5663bf606c5e1e8d /indra | |
parent | d1a4cbb8fa9058c4d3a8fc3ebe3a543626aac77e (diff) |
Fix potential null pointer deref during image upload
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llviewertexturelist.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 752cfb3884..bc9732a9ef 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1422,6 +1422,11 @@ bool LLViewerTextureList::createUploadFile(LLPointer<LLImageRaw> raw_image, raw_image->getComponents()); LLPointer<LLImageJ2C> compressedImage = LLViewerTextureList::convertToUploadFile(scale_image, max_image_dimentions); + if (compressedImage.isNull()) + { + LL_INFOS() << "Couldn't convert to j2c, file : " << out_filename << LL_ENDL; + return false; + } if (compressedImage->getWidth() < min_image_dimentions || compressedImage->getHeight() < min_image_dimentions) { std::string reason = llformat("Images below %d x %d pixels are not allowed. Actual size: %d x %dpx", @@ -1432,12 +1437,6 @@ bool LLViewerTextureList::createUploadFile(LLPointer<LLImageRaw> raw_image, compressedImage->setLastError(reason); return false; } - if (compressedImage.isNull()) - { - compressedImage->setLastError("Couldn't convert the image to jpeg2000."); - LL_INFOS() << "Couldn't convert to j2c, file : " << out_filename << LL_ENDL; - return false; - } if (!compressedImage->save(out_filename)) { compressedImage->setLastError("Couldn't create the jpeg2000 image for upload."); |