From c7c4a5153ec00b64c60dc0dee27463ad3a417086 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 20 Oct 2016 16:48:14 +0200 Subject: [PATCH] Port fix for MAINT-4327/MAINT-6584 to OpenJPEG decoder --- indra/llimagej2coj/llimagej2coj.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp index 5215771c0a..02325810cb 100644 --- a/indra/llimagej2coj/llimagej2coj.cpp +++ b/indra/llimagej2coj/llimagej2coj.cpp @@ -262,6 +262,16 @@ bool LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod raw_image.resize(width, height, channels); U8 *rawp = raw_image.getData(); + // Port fix for MAINT-4327/MAINT-6584 to OpenJPEG decoder + if (!rawp) + { + base.setLastError("Memory error"); + base.decodeFailed(); + opj_image_destroy(image); + return true; // done + } + // + // first_channel is what channel to start copying from // dest is what channel to copy to. first_channel comes from the // argument, dest always starts writing at channel zero.