diff options
author | AndreyL ProductEngine <alihatskiy@productengine.com> | 2017-06-07 03:16:56 +0300 |
---|---|---|
committer | AndreyL ProductEngine <alihatskiy@productengine.com> | 2017-06-07 03:16:56 +0300 |
commit | f2780a93c082e9c9a9557b7b0f6378980632b634 (patch) | |
tree | 1b494c70766b8568dec16ab9c958cd5c2b9252db | |
parent | 54d3e2634d66f3d32eef91ee81688276aeebd8ad (diff) |
MAINT-6697 Added a nullcheck to unzip_llsd()
-rw-r--r-- | indra/llcommon/llsdserialize.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 81ba8631c6..41cdb14886 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -2175,6 +2175,14 @@ 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); + free(result); + delete[] in; + return false; + } memcpy(result+cur_size, out, have); cur_size += have; |