summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreyL ProductEngine <alihatskiy@productengine.com>2017-06-07 20:59:30 +0300
committerAndreyL ProductEngine <alihatskiy@productengine.com>2017-06-07 20:59:30 +0300
commit71f580e72a0f16cc4b29a7132af5be154ad128a7 (patch)
treed1a3a03899606db78ab4f854de8af879a2636ebc
parent47ae78f8cfc9ca71bf9837b06618d34737b07fc4 (diff)
parentd9fe21f17f8c392a602773fa36b0814a0c672761 (diff)
Merged in lindenlab/viewer-lynx
-rw-r--r--indra/llcommon/llsdserialize.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index 81ba8631c6..0568a639a0 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -2092,6 +2092,12 @@ std::string zip_llsd(LLSD& data)
have = CHUNK-strm.avail_out;
output = (U8*) realloc(output, cur_size+have);
+ if (output == NULL)
+ {
+ LL_WARNS() << "Failed to compress LLSD block: can't reallocate memory, current size: " << cur_size << " bytes; requested " << cur_size + have << " bytes." << LL_ENDL;
+ deflateEnd(&strm);
+ return std::string();
+ }
memcpy(output+cur_size, out, have);
cur_size += have;
}
@@ -2175,6 +2181,13 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
U32 have = CHUNK-strm.avail_out;
result = (U8*) realloc(result, cur_size + have);
+ if (result == NULL)
+ {
+ LL_WARNS() << "Failed to unzip LLSD block: can't reallocate memory, current size: " << cur_size << " bytes; requested " << cur_size + have << " bytes." << LL_ENDL;
+ inflateEnd(&strm);
+ delete[] in;
+ return false;
+ }
memcpy(result+cur_size, out, have);
cur_size += have;
@@ -2267,6 +2280,14 @@ U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize, std::istream& is, S32
U32 have = CHUNK-strm.avail_out;
result = (U8*) realloc(result, cur_size + have);
+ if (result == NULL)
+ {
+ LL_WARNS() << "Failed to unzip LLSD NavMesh block: can't reallocate memory, current size: " << cur_size << " bytes; requested " << cur_size + have << " bytes." << LL_ENDL;
+ inflateEnd(&strm);
+ delete[] in;
+ valid = false;
+ return NULL;
+ }
memcpy(result+cur_size, out, have);
cur_size += have;