MAINT-2791: Yet another crash in LLTextureCache::writeToFastCache(). Reviewed

by Kelly
master
simon 2013-06-14 11:32:12 -07:00
parent 3698aece0d
commit f62d04d425
1 changed files with 5 additions and 2 deletions

View File

@ -1925,9 +1925,12 @@ bool LLTextureCache::writeToFastCache(S32 id, LLPointer<LLImageRaw> raw, S32 dis
memcpy(mFastCachePadBuffer + sizeof(S32), &h, sizeof(S32));
memcpy(mFastCachePadBuffer + sizeof(S32) * 2, &c, sizeof(S32));
memcpy(mFastCachePadBuffer + sizeof(S32) * 3, &discardlevel, sizeof(S32));
if(w * h * c > 0) //valid
S32 copy_size = w * h * c;
if(copy_size > 0) //valid
{
memcpy(mFastCachePadBuffer + TEXTURE_FAST_CACHE_ENTRY_OVERHEAD, raw->getData(), w * h * c);
copy_size = llmin(copy_size, TEXTURE_FAST_CACHE_ENTRY_SIZE - TEXTURE_FAST_CACHE_ENTRY_OVERHEAD);
memcpy(mFastCachePadBuffer + TEXTURE_FAST_CACHE_ENTRY_OVERHEAD, raw->getData(), copy_size);
}
S32 offset = id * TEXTURE_FAST_CACHE_ENTRY_SIZE;