From 7abecb48babe6a6f09bf6692ba55076546cfced9 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Mon, 1 Dec 2008 17:39:58 -0600 Subject: Second Life viewer sources 1.22.0-RC --- linden/indra/llimagej2coj/llimagej2coj.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'linden/indra/llimagej2coj/llimagej2coj.cpp') diff --git a/linden/indra/llimagej2coj/llimagej2coj.cpp b/linden/indra/llimagej2coj/llimagej2coj.cpp index 983241c..7a62cfd 100644 --- a/linden/indra/llimagej2coj/llimagej2coj.cpp +++ b/linden/indra/llimagej2coj/llimagej2coj.cpp @@ -151,9 +151,11 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod // dereference the array. if(!image || !image->numcomps) { - fprintf(stderr, "ERROR -> decodeImpl: failed to decode image!\n"); + llwarns << "ERROR -> decodeImpl: failed to decode image!" << llendl; if (image) + { opj_image_destroy(image); + } return TRUE; // done } @@ -170,6 +172,17 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod } } + if(image->numcomps <= first_channel) + { + llwarns << "trying to decode more channels than are present in image: numcomps: " << image->numcomps << " first_channel: " << first_channel << llendl; + if (image) + { + opj_image_destroy(image); + } + + return TRUE; + } + // Copy image data into our raw image format (instead of the separate channel format S32 img_components = image->numcomps; @@ -211,7 +224,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod } else // Some rare OpenJPEG versions have this bug. { - fprintf(stderr, "ERROR -> decodeImpl: failed to decode image! (NULL comp data - OpenJPEG bug)\n"); + llwarns << "ERROR -> decodeImpl: failed to decode image! (NULL comp data - OpenJPEG bug)" << llendl; opj_image_destroy(image); return TRUE; // done @@ -430,7 +443,7 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base) if(!image) { - fprintf(stderr, "ERROR -> getMetadata: failed to decode image!\n"); + llwarns << "ERROR -> getMetadata: failed to decode image!" << llendl; return FALSE; } -- cgit v1.1 From a87e38229921b48c32187c672a942516722f1b52 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sun, 11 Jan 2009 16:10:39 -0600 Subject: Second Life viewer sources 1.22.5-RC --- linden/indra/llimagej2coj/llimagej2coj.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linden/indra/llimagej2coj/llimagej2coj.cpp') diff --git a/linden/indra/llimagej2coj/llimagej2coj.cpp b/linden/indra/llimagej2coj/llimagej2coj.cpp index 7a62cfd..5afac0e 100644 --- a/linden/indra/llimagej2coj/llimagej2coj.cpp +++ b/linden/indra/llimagej2coj/llimagej2coj.cpp @@ -4,7 +4,7 @@ * * $LicenseInfo:firstyear=2006&license=viewergpl$ * - * Copyright (c) 2006-2008, Linden Research, Inc. + * Copyright (c) 2006-2009, Linden Research, Inc. * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab -- cgit v1.1