From b44158591b06704de6506d4ec03314e93c800adb Mon Sep 17 00:00:00 2001 From: Rye Cogtail Date: Wed, 30 Oct 2024 15:29:59 -0400 Subject: Fix potential null pointer deref during image upload --- indra/newview/llviewertexturelist.cpp | 11 +++++------ 1 file 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 raw_image, raw_image->getComponents()); LLPointer 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 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."); -- cgit v1.2.3