diff options
author | Armin Weatherwax | 2010-02-03 17:10:57 +0100 |
---|---|---|
committer | Jacek Antonelli | 2010-02-22 01:39:11 -0600 |
commit | 973f07db7982e78c634c29f6139dea547a111141 (patch) | |
tree | d98b613386f9de0151a7b8528ac366d700b5e91c | |
parent | Fixed an error at shutdown (gSavedSettings.cleanup). (diff) | |
download | meta-impy-973f07db7982e78c634c29f6139dea547a111141.zip meta-impy-973f07db7982e78c634c29f6139dea547a111141.tar.gz meta-impy-973f07db7982e78c634c29f6139dea547a111141.tar.bz2 meta-impy-973f07db7982e78c634c29f6139dea547a111141.tar.xz |
Fixed a rare crash from textures with too many components.
Only seen in lbsa plaza on OSGrid, so far.
-rw-r--r-- | ChangeLog.txt | 10 | ||||
-rw-r--r-- | linden/indra/llimagej2coj/llimagej2coj.cpp | 29 | ||||
-rw-r--r-- | linden/indra/llrender/llimagegl.cpp | 4 | ||||
-rw-r--r-- | linden/indra/newview/app_settings/logcontrol.xml | 2 |
4 files changed, 35 insertions, 10 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt index a6dbd4d..2e1096f 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt | |||
@@ -243,6 +243,16 @@ | |||
243 | modified: linden/indra/newview/llviewercontrol.cpp | 243 | modified: linden/indra/newview/llviewercontrol.cpp |
244 | 244 | ||
245 | 245 | ||
246 | 2010-02-03 Armin Weatherwax <Armin.Weatherwax@gmail.com> | ||
247 | |||
248 | * Fixed a rare crash from textures with too many components. | ||
249 | Only seen in lbsa plaza on OSGrid, so far. | ||
250 | |||
251 | modified: linden/indra/llimagej2coj/llimagej2coj.cpp | ||
252 | modified: linden/indra/llrender/llimagegl.cpp | ||
253 | modified: linden/indra/newview/app_settings/logcontrol.xml | ||
254 | |||
255 | |||
246 | 2010-01-30 Jacek Antonelli <jacek.antonelli@gmail.com> | 256 | 2010-01-30 Jacek Antonelli <jacek.antonelli@gmail.com> |
247 | 257 | ||
248 | * Improved "Pay Object" floater layout and XML. | 258 | * Improved "Pay Object" floater layout and XML. |
diff --git a/linden/indra/llimagej2coj/llimagej2coj.cpp b/linden/indra/llimagej2coj/llimagej2coj.cpp index be6b6c8..b7a1b82 100644 --- a/linden/indra/llimagej2coj/llimagej2coj.cpp +++ b/linden/indra/llimagej2coj/llimagej2coj.cpp | |||
@@ -99,6 +99,7 @@ void info_callback(const char* msg, void*) | |||
99 | 99 | ||
100 | LLImageJ2COJ::LLImageJ2COJ() : LLImageJ2CImpl() | 100 | LLImageJ2COJ::LLImageJ2COJ() : LLImageJ2CImpl() |
101 | { | 101 | { |
102 | mRawImagep=NULL; | ||
102 | } | 103 | } |
103 | 104 | ||
104 | 105 | ||
@@ -166,9 +167,17 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod | |||
166 | // The image decode failed if the return was NULL or the component | 167 | // The image decode failed if the return was NULL or the component |
167 | // count was zero. The latter is just a sanity check before we | 168 | // count was zero. The latter is just a sanity check before we |
168 | // dereference the array. | 169 | // dereference the array. |
169 | if(!image || !image->numcomps) | 170 | if(!image) |
170 | { | 171 | { |
171 | llwarns << "ERROR -> decodeImpl: failed to decode image!" << llendl; | 172 | LL_DEBUGS("Openjpeg") << "ERROR -> decodeImpl: failed to decode image - no image" << LL_ENDL; |
173 | return TRUE; // done | ||
174 | } | ||
175 | |||
176 | S32 img_components = image->numcomps; | ||
177 | |||
178 | if( !img_components ) // < 1 ||img_components > 4 ) | ||
179 | { | ||
180 | LL_DEBUGS("Openjpeg") << "ERROR -> decodeImpl: failed to decode image wrong number of components: " << img_components << LL_ENDL; | ||
172 | if (image) | 181 | if (image) |
173 | { | 182 | { |
174 | opj_image_destroy(image); | 183 | opj_image_destroy(image); |
@@ -178,20 +187,21 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod | |||
178 | } | 187 | } |
179 | 188 | ||
180 | // sometimes we get bad data out of the cache - check to see if the decode succeeded | 189 | // sometimes we get bad data out of the cache - check to see if the decode succeeded |
181 | for (S32 i = 0; i < image->numcomps; i++) | 190 | for (S32 i = 0; i < img_components; i++) |
182 | { | 191 | { |
183 | if (image->comps[i].factor != base.getRawDiscardLevel()) | 192 | if (image->comps[i].factor != base.getRawDiscardLevel()) |
184 | { | 193 | { |
185 | // if we didn't get the discard level we're expecting, fail | 194 | // if we didn't get the discard level we're expecting, fail |
186 | opj_image_destroy(image); | 195 | if (image) //anyway somthing odd with the image, better check than crash |
196 | opj_image_destroy(image); | ||
187 | base.mDecoding = FALSE; | 197 | base.mDecoding = FALSE; |
188 | return TRUE; | 198 | return TRUE; |
189 | } | 199 | } |
190 | } | 200 | } |
191 | 201 | ||
192 | if(image->numcomps <= first_channel) | 202 | if(img_components <= first_channel) |
193 | { | 203 | { |
194 | llwarns << "trying to decode more channels than are present in image: numcomps: " << image->numcomps << " first_channel: " << first_channel << llendl; | 204 | LL_DEBUGS("Openjpeg") << "trying to decode more channels than are present in image: numcomps: " << img_components << " first_channel: " << first_channel << LL_ENDL; |
195 | if (image) | 205 | if (image) |
196 | { | 206 | { |
197 | opj_image_destroy(image); | 207 | opj_image_destroy(image); |
@@ -202,7 +212,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod | |||
202 | 212 | ||
203 | // Copy image data into our raw image format (instead of the separate channel format | 213 | // Copy image data into our raw image format (instead of the separate channel format |
204 | 214 | ||
205 | S32 img_components = image->numcomps; | 215 | |
206 | S32 channels = img_components - first_channel; | 216 | S32 channels = img_components - first_channel; |
207 | if( channels > max_channel_count ) | 217 | if( channels > max_channel_count ) |
208 | channels = max_channel_count; | 218 | channels = max_channel_count; |
@@ -249,7 +259,10 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod | |||
249 | } | 259 | } |
250 | 260 | ||
251 | /* free image data structure */ | 261 | /* free image data structure */ |
252 | opj_image_destroy(image); | 262 | if (image) |
263 | { | ||
264 | opj_image_destroy(image); | ||
265 | } | ||
253 | 266 | ||
254 | return TRUE; // done | 267 | return TRUE; // done |
255 | } | 268 | } |
diff --git a/linden/indra/llrender/llimagegl.cpp b/linden/indra/llrender/llimagegl.cpp index 27b1d55..544eb80 100644 --- a/linden/indra/llrender/llimagegl.cpp +++ b/linden/indra/llrender/llimagegl.cpp | |||
@@ -1014,7 +1014,9 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S | |||
1014 | mFormatType = GL_UNSIGNED_BYTE; | 1014 | mFormatType = GL_UNSIGNED_BYTE; |
1015 | break; | 1015 | break; |
1016 | default: | 1016 | default: |
1017 | llerrs << "Bad number of components for texture: " << (U32)getComponents() << llendl; | 1017 | LL_DEBUGS("Openjpeg") << "Bad number of components for texture: " << (U32)getComponents() << LL_ENDL; |
1018 | to_create = false; | ||
1019 | break; | ||
1018 | } | 1020 | } |
1019 | } | 1021 | } |
1020 | 1022 | ||
diff --git a/linden/indra/newview/app_settings/logcontrol.xml b/linden/indra/newview/app_settings/logcontrol.xml index 60f78b7..401b145 100644 --- a/linden/indra/newview/app_settings/logcontrol.xml +++ b/linden/indra/newview/app_settings/logcontrol.xml | |||
@@ -51,7 +51,7 @@ | |||
51 | <string>MediaState</string> | 51 | <string>MediaState</string> |
52 | <string>ShaderLoading</string> | 52 | <string>ShaderLoading</string> |
53 | <string>XMLNode</string> | 53 | <string>XMLNode</string> |
54 | 54 | <string>Openjpeg</string> | |
55 | <!--Unused debug messages below--> | 55 | <!--Unused debug messages below--> |
56 | 56 | ||
57 | <!--<string>RLV</string> | 57 | <!--<string>RLV</string> |