diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llimagej2coj/llimagej2coj.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/linden/indra/llimagej2coj/llimagej2coj.cpp b/linden/indra/llimagej2coj/llimagej2coj.cpp index 983241c..a0c61d8 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 | |||
151 | // dereference the array. | 151 | // dereference the array. |
152 | if(!image || !image->numcomps) | 152 | if(!image || !image->numcomps) |
153 | { | 153 | { |
154 | fprintf(stderr, "ERROR -> decodeImpl: failed to decode image!\n"); | 154 | llwarns << "ERROR -> decodeImpl: failed to decode image!" << llendl; |
155 | if (image) | 155 | if (image) |
156 | { | ||
156 | opj_image_destroy(image); | 157 | opj_image_destroy(image); |
158 | } | ||
157 | 159 | ||
158 | return TRUE; // done | 160 | return TRUE; // done |
159 | } | 161 | } |
@@ -169,6 +171,17 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod | |||
169 | return TRUE; | 171 | return TRUE; |
170 | } | 172 | } |
171 | } | 173 | } |
174 | |||
175 | if(image->numcomps <= first_channel) | ||
176 | { | ||
177 | llwarns << "trying to decode more channels than are present in image: numcomps: " << image->numcomps << " first_channel: " << first_channel << llendl; | ||
178 | if (image) | ||
179 | { | ||
180 | opj_image_destroy(image); | ||
181 | } | ||
182 | |||
183 | return TRUE; | ||
184 | } | ||
172 | 185 | ||
173 | // Copy image data into our raw image format (instead of the separate channel format | 186 | // Copy image data into our raw image format (instead of the separate channel format |
174 | 187 | ||
@@ -211,7 +224,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod | |||
211 | } | 224 | } |
212 | else // Some rare OpenJPEG versions have this bug. | 225 | else // Some rare OpenJPEG versions have this bug. |
213 | { | 226 | { |
214 | fprintf(stderr, "ERROR -> decodeImpl: failed to decode image! (NULL comp data - OpenJPEG bug)\n"); | 227 | llwarns << "ERROR -> decodeImpl: failed to decode image! (NULL comp data - OpenJPEG bug)" << llendl; |
215 | opj_image_destroy(image); | 228 | opj_image_destroy(image); |
216 | 229 | ||
217 | return TRUE; // done | 230 | return TRUE; // done |
@@ -430,7 +443,7 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base) | |||
430 | 443 | ||
431 | if(!image) | 444 | if(!image) |
432 | { | 445 | { |
433 | fprintf(stderr, "ERROR -> getMetadata: failed to decode image!\n"); | 446 | llwarns << "ERROR -> getMetadata: failed to decode image!" << llendl; |
434 | return FALSE; | 447 | return FALSE; |
435 | } | 448 | } |
436 | 449 | ||