summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturecache.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-12-05 12:05:33 -0500
committerNat Goodspeed <nat@lindenlab.com>2012-12-05 12:05:33 -0500
commit377544c8b40f2d35ba7b29252ed471d19bb983e5 (patch)
tree0fb68b6d7f9ce04b7126d08365f0f6cb483e57f7 /indra/newview/lltexturecache.cpp
parentcc2c426e88bfff91c1da1704d5fdedee6e7e3dbb (diff)
parent5a938e3a1c8582d6bfe6df2aa195afcdcafb355a (diff)
merge changes for MAINT-1955, MAINT-1958
Diffstat (limited to 'indra/newview/lltexturecache.cpp')
-rw-r--r--indra/newview/lltexturecache.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index a61e2d5c86..2d463f0afa 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -1861,7 +1861,12 @@ LLPointer<LLImageRaw> LLTextureCache::readFromFastCache(const LLUUID& id, S32& d
mFastCachep->seek(APR_SET, offset);
- llassert_always(mFastCachep->read(head, TEXTURE_FAST_CACHE_ENTRY_OVERHEAD) == TEXTURE_FAST_CACHE_ENTRY_OVERHEAD);
+ if(mFastCachep->read(head, TEXTURE_FAST_CACHE_ENTRY_OVERHEAD) != TEXTURE_FAST_CACHE_ENTRY_OVERHEAD)
+ {
+ //cache corrupted or under thread race condition
+ closeFastCache();
+ return NULL;
+ }
S32 image_size = head[0] * head[1] * head[2];
if(!image_size) //invalid
@@ -1872,7 +1877,13 @@ LLPointer<LLImageRaw> LLTextureCache::readFromFastCache(const LLUUID& id, S32& d
discardlevel = head[3];
data = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), image_size);
- llassert_always(mFastCachep->read(data, image_size) == image_size);
+ if(mFastCachep->read(data, image_size) != image_size)
+ {
+ FREE_MEM(LLImageBase::getPrivatePool(), data);
+ closeFastCache();
+ return NULL;
+ }
+
closeFastCache();
}
LLPointer<LLImageRaw> raw = new LLImageRaw(data, head[0], head[1], head[2], true);