diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2018-06-30 12:43:08 +0200 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2018-06-30 12:43:08 +0200 |
commit | a98326eb2954ac1e79f5eac28dbeab3ec15e047f (patch) | |
tree | bb16257a1894b488e365851273735ec13a9442ef /wx+/zlib_wrap.h | |
parent | 10.0 (diff) | |
download | FreeFileSync-a98326eb2954ac1e79f5eac28dbeab3ec15e047f.tar.gz FreeFileSync-a98326eb2954ac1e79f5eac28dbeab3ec15e047f.tar.bz2 FreeFileSync-a98326eb2954ac1e79f5eac28dbeab3ec15e047f.zip |
10.1
Diffstat (limited to 'wx+/zlib_wrap.h')
-rwxr-xr-x | wx+/zlib_wrap.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/wx+/zlib_wrap.h b/wx+/zlib_wrap.h index 7265331e..d3bb017b 100755 --- a/wx+/zlib_wrap.h +++ b/wx+/zlib_wrap.h @@ -52,8 +52,8 @@ BinContainer compress(const BinContainer& stream, int level) //throw ZlibInterna //save uncompressed stream size for decompression const uint64_t uncompressedSize = stream.size(); //use portable number type! contOut.resize(sizeof(uncompressedSize)); - std::copy(reinterpret_cast<const char*>(&uncompressedSize), - reinterpret_cast<const char*>(&uncompressedSize) + sizeof(uncompressedSize), + std::copy(reinterpret_cast<const std::byte*>(&uncompressedSize), + reinterpret_cast<const std::byte*>(&uncompressedSize) + sizeof(uncompressedSize), &*contOut.begin()); const size_t bufferEstimate = impl::zlib_compressBound(stream.size()); //upper limit for buffer size, larger than input size!!! @@ -85,7 +85,7 @@ BinContainer decompress(const BinContainer& stream) //throw ZlibInternalError throw ZlibInternalError(); std::copy(&*stream.begin(), &*stream.begin() + sizeof(uncompressedSize), - reinterpret_cast<char*>(&uncompressedSize)); + reinterpret_cast<std::byte*>(&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! |