diff options
author | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:53:20 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:53:20 +0200 |
commit | 94db751716dd2851f99b5c4c2981da1d1f4780f8 (patch) | |
tree | e4ffc9f5ae2b2873f267a6e5d3d2092c8aad49a7 /wx+/zlib_wrap.h | |
parent | 6.10 (diff) | |
download | FreeFileSync-94db751716dd2851f99b5c4c2981da1d1f4780f8.tar.gz FreeFileSync-94db751716dd2851f99b5c4c2981da1d1f4780f8.tar.bz2 FreeFileSync-94db751716dd2851f99b5c4c2981da1d1f4780f8.zip |
6.11
Diffstat (limited to 'wx+/zlib_wrap.h')
-rw-r--r-- | wx+/zlib_wrap.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/wx+/zlib_wrap.h b/wx+/zlib_wrap.h index 4cdc96b3..c271276f 100644 --- a/wx+/zlib_wrap.h +++ b/wx+/zlib_wrap.h @@ -85,12 +85,12 @@ BinContainer decompress(const BinContainer& stream) //throw ZlibInternalError std::copy(&*stream.begin(), &*stream.begin() + sizeof(uncompressedSize), reinterpret_cast<char*>(&uncompressedSize)); - //attention: contOut MUST NOT be empty! Else it will pass a nullptr to zlib_decompress() => Z_STREAM_ERROR although "uncompressedSize == 0"!!! - //secondary bug: don't dereference iterator into empty container! - if (uncompressedSize == 0) //cannot be 0: compress() directly maps empty -> empty container skipping zlib! - throw ZlibInternalError(); + //attention: contOut MUST NOT be empty! Else it will pass a nullptr to zlib_decompress() => Z_STREAM_ERROR although "uncompressedSize == 0"!!! + //secondary bug: don't dereference iterator into empty container! + if (uncompressedSize == 0) //cannot be 0: compress() directly maps empty -> empty container skipping zlib! + throw ZlibInternalError(); - try + try { contOut.resize(static_cast<size_t>(uncompressedSize)); //throw std::bad_alloc } |