summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturecache.cpp
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2012-11-26 17:28:17 -0700
committerXiaohong Bao <bao@lindenlab.com>2012-11-26 17:28:17 -0700
commit8d07be97750065cacaf513f496935c3f67b8b40a (patch)
tree3e3492cd4406c1bdd808a1c4a08eb6aca4336f55 /indra/newview/lltexturecache.cpp
parent3df1e46588c7bada79e8ee537607282fd3cdcc9f (diff)
parentfe2f9e12f7a4722c71437e6d0c66325b1b58d711 (diff)
Automated merge with https://bitbucket.org/lindenlab/viewer-cat
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);