summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2018-02-19 21:30:48 +0200
committerandreykproductengine <andreykproductengine@lindenlab.com>2018-02-19 21:30:48 +0200
commitf22c1bcf2014346211ecc32c21d48cc88aca8e07 (patch)
tree166d02e5176a405fc57f35b031605272a57e84fc /indra
parent5efc817d9a76fe0b169b831393d794fc2257261b (diff)
MAINT-8022 Handling memory errors in unzip_llsdNavMesh
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llsdserialize.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index 580e87954b..26a4967659 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -2262,13 +2262,24 @@ LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is,
//and trailers are different for the formats.
U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize, std::istream& is, S32 size )
{
+ if (size == 0)
+ {
+ LL_WARNS() << "No data to unzip." << LL_ENDL;
+ return NULL;
+ }
+
U8* result = NULL;
U32 cur_size = 0;
z_stream strm;
const U32 CHUNK = 0x4000;
- U8 *in = new U8[size];
+ U8 *in = new(std::nothrow) U8[size];
+ if (in == NULL)
+ {
+ LL_WARNS() << "Memory allocation failure." << LL_ENDL;
+ return NULL;
+ }
is.read((char*) in, size);
U8 out[CHUNK];