diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2019-10-28 23:21:40 +0000 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2019-10-28 23:21:40 +0000 |
commit | 8d6d4e48a61fd974c3fb2a85254f9bedd796a2b7 (patch) | |
tree | 65292208a81994782e1c16dd84dfcdcc221d0cd7 /zen/zlib_wrap.h | |
parent | Merge branch '10.16' into 'master' (diff) | |
parent | add upstream 10.17 (diff) | |
download | FreeFileSync-8d6d4e48a61fd974c3fb2a85254f9bedd796a2b7.tar.gz FreeFileSync-8d6d4e48a61fd974c3fb2a85254f9bedd796a2b7.tar.bz2 FreeFileSync-8d6d4e48a61fd974c3fb2a85254f9bedd796a2b7.zip |
Merge branch '10.17' into 'master'10.17
10.17
See merge request opensource-tracking/FreeFileSync!14
Diffstat (limited to 'zen/zlib_wrap.h')
-rw-r--r-- | zen/zlib_wrap.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/zen/zlib_wrap.h b/zen/zlib_wrap.h index fbe26193..9d9229ac 100644 --- a/zen/zlib_wrap.h +++ b/zen/zlib_wrap.h @@ -90,14 +90,14 @@ BinContainer decompress(const BinContainer& stream) //throw SysError //retrieve size of uncompressed data uint64_t uncompressedSize = 0; //use portable number type! if (stream.size() < sizeof(uncompressedSize)) - throw SysError(L"zlib error: stream size < 8"); + throw SysError(L"zlib error: stream size < 8"); std::memcpy(&uncompressedSize, &*stream.begin(), sizeof(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 SysError(L"zlib error: uncompressed size == 0"); + throw SysError(L"zlib error: uncompressed size == 0"); try { @@ -105,7 +105,7 @@ BinContainer decompress(const BinContainer& stream) //throw SysError } catch (const std::bad_alloc& e) //most likely due to data corruption! { - throw SysError(L"zlib error: " + _("Out of memory.") + L" " + utfTo<std::wstring>(e.what())); + throw SysError(L"zlib error: " + _("Out of memory.") + L" " + utfTo<std::wstring>(e.what())); } const size_t bytesWritten = impl::zlib_decompress(&*stream.begin() + sizeof(uncompressedSize), |