From b35201c19ee61841aaea77f41b044bc7f53996a3 Mon Sep 17 00:00:00 2001 From: thickbrick Date: Tue, 5 Oct 2010 19:51:23 +0200 Subject: Fix RED-603: Errors when loading local images Avoid bad offsets that would cause failure with this warning: "doRead: Error reading file from local cache" --- linden/indra/newview/lltexturecache.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/lltexturecache.cpp b/linden/indra/newview/lltexturecache.cpp index 46c125f..0c35b32 100644 --- a/linden/indra/newview/lltexturecache.cpp +++ b/linden/indra/newview/lltexturecache.cpp @@ -372,9 +372,10 @@ bool LLTextureCacheRemoteWorker::doRead() if (!done && (mState == LOCAL)) { llassert(local_size != 0); // we're assuming there is a non empty local file here... - if (!mDataSize || mDataSize > local_size) + llassert(mReadData == NULL); + if (!mDataSize || mDataSize > (local_size - mOffset)) { - mDataSize = local_size; + mDataSize = local_size - mOffset; } // Allocate read buffer mReadData = new U8[mDataSize]; -- cgit v1.1