summaryrefslogtreecommitdiff
path: root/indra/llmessage/llhttpassetstorage.cpp
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2007-09-14 21:13:20 +0000
committerDon Kjer <don@lindenlab.com>2007-09-14 21:13:20 +0000
commit13c391f1984bb8cb9d67a7729af2ee5714409215 (patch)
tree112edff1d25adabb4893e6746ba76a4182865f8a /indra/llmessage/llhttpassetstorage.cpp
parentb3d807d5ff8dca6c891e9a5e0ddc7bc147d69f8c (diff)
EFFECTIVE MERGE: svn merge -r 68118:68999 svn+ssh://svn/svn/linden/branches/maintenance
ACTUAL MERGE: svn merge -r 69685:69687 svn+ssh://svn/svn/linden/branches/release-r69649-maintenance-sync EQUIVALENT TO: svn merge -r 68118:69663 svn+ssh://svn/svn/linden/branches/maintenance-r68999
Diffstat (limited to 'indra/llmessage/llhttpassetstorage.cpp')
-rw-r--r--indra/llmessage/llhttpassetstorage.cpp33
1 files changed, 22 insertions, 11 deletions
diff --git a/indra/llmessage/llhttpassetstorage.cpp b/indra/llmessage/llhttpassetstorage.cpp
index 23b90aef71..7b07dfd0e0 100644
--- a/indra/llmessage/llhttpassetstorage.cpp
+++ b/indra/llmessage/llhttpassetstorage.cpp
@@ -321,8 +321,15 @@ size_t LLHTTPAssetRequest::readCompressedData(void* data, size_t size)
S32 to_read = llmin(COMPRESSED_INPUT_BUFFER_SIZE,
(S32)(mVFile->getSize() - mVFile->tell()));
- mVFile->read((U8*)mZInputBuffer, to_read); /*Flawfinder: ignore*/
-
+ if ( to_read > 0 )
+ {
+ mVFile->read((U8*)mZInputBuffer, to_read); /*Flawfinder: ignore*/
+ }
+ else
+ {
+ llwarns << "LLHTTPAssetRequest::readCompressedData has zero read length" << llendl;
+ break;
+ }
mZStream.next_in = (Bytef*)mZInputBuffer;
mZStream.avail_in = mVFile->getLastBytesRead();
@@ -332,7 +339,7 @@ size_t LLHTTPAssetRequest::readCompressedData(void* data, size_t size)
int r = deflate(&mZStream,
mZInputExhausted ? Z_FINISH : Z_NO_FLUSH);
- if (r == Z_STREAM_END)
+ if (r == Z_STREAM_END || r < 0)
{
break;
}
@@ -345,15 +352,20 @@ size_t LLHTTPAssetRequest::readCompressedData(void* data, size_t size)
size_t LLHTTPAssetRequest::curlCompressedUploadCallback(
void *data, size_t size, size_t nmemb, void *user_data)
{
- if (!gAssetStorage)
+ size_t num_read = 0;
+
+ if (gAssetStorage)
{
- return 0;
+ CURL *curl_handle = (CURL *)user_data;
+ LLHTTPAssetRequest *req = NULL;
+ curl_easy_getinfo(curl_handle, CURLINFO_PRIVATE, &req);
+ if (req)
+ {
+ num_read = req->readCompressedData(data, size * nmemb);
+ }
}
- CURL *curl_handle = (CURL *)user_data;
- LLHTTPAssetRequest *req = NULL;
- curl_easy_getinfo(curl_handle, CURLINFO_PRIVATE, &req);
- return req->readCompressedData(data, size * nmemb);
+ return num_read;
}
/////////////////////////////////////////////////////////////////////////////////
@@ -511,9 +523,8 @@ void LLHTTPAssetStorage::storeAssetData(
{
callback(LLUUID::null, user_data, LL_ERR_CANNOT_OPEN_FILE, LL_EXSTAT_BLOCKED_FILE);
}
+ delete legacy;
}
- // Coverity CID-269 says there's a leak of 'legacy' here, but
- // legacyStoreDataCallback() will delete it somewhere down the line.
}
// virtual