diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2018-02-19 21:30:48 +0200 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2018-02-19 21:30:48 +0200 |
commit | f22c1bcf2014346211ecc32c21d48cc88aca8e07 (patch) | |
tree | 166d02e5176a405fc57f35b031605272a57e84fc /indra | |
parent | 5efc817d9a76fe0b169b831393d794fc2257261b (diff) |
MAINT-8022 Handling memory errors in unzip_llsdNavMesh
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llcommon/llsdserialize.cpp | 13 |
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]; |