diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-09-23 01:53:11 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-09-23 01:53:11 +0000 |
commit | afe61eb994377e25d60d0a0893510a693149c6be (patch) | |
tree | 80c6e33cd664e5c8b1c5f55c3b7b49c081dd590a /indra/llimagej2coj | |
parent | 2945882258ad1befe8e8094c0a1a655e4ddbcd30 (diff) |
QAR-849 merge maint-viewer-10-merge 96838-97237 -> release
Diffstat (limited to 'indra/llimagej2coj')
-rw-r--r-- | indra/llimagej2coj/llimagej2coj.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp index 2818859d93..fc3b89d746 100644 --- a/indra/llimagej2coj/llimagej2coj.cpp +++ b/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; } |