diff options
author | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:50:33 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:50:33 +0200 |
commit | b6d9c83c8386c83f0e2c3ffeaded184f60635bb4 (patch) | |
tree | b404f53d08361eef07350d21f4002f8b1def711c /wx+/zlib_wrap.h | |
parent | 6.6 (diff) | |
download | FreeFileSync-b6d9c83c8386c83f0e2c3ffeaded184f60635bb4.tar.gz FreeFileSync-b6d9c83c8386c83f0e2c3ffeaded184f60635bb4.tar.bz2 FreeFileSync-b6d9c83c8386c83f0e2c3ffeaded184f60635bb4.zip |
6.7
Diffstat (limited to 'wx+/zlib_wrap.h')
-rw-r--r-- | wx+/zlib_wrap.h | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/wx+/zlib_wrap.h b/wx+/zlib_wrap.h index c6545c9d..4cdc96b3 100644 --- a/wx+/zlib_wrap.h +++ b/wx+/zlib_wrap.h @@ -4,8 +4,8 @@ // * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** -#ifndef SIMPLE_H_INCLUDED_18134135134135345489 -#define SIMPLE_H_INCLUDED_18134135134135345489 +#ifndef ZLIB_H_INCLUDED_428597064566 +#define ZLIB_H_INCLUDED_428597064566 #include <zen/serialize.h> @@ -33,15 +33,6 @@ BinContainer decompress(const BinContainer& stream); //throw ZlibIntern - - - - - - - - - //######################## implementation ########################## namespace impl { @@ -94,13 +85,13 @@ BinContainer decompress(const BinContainer& stream) //throw ZlibInternalError std::copy(&*stream.begin(), &*stream.begin() + sizeof(uncompressedSize), reinterpret_cast<char*>(&uncompressedSize)); - try - { //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 + { contOut.resize(static_cast<size_t>(uncompressedSize)); //throw std::bad_alloc } catch (std::bad_alloc&) //most likely due to data corruption! @@ -119,4 +110,4 @@ BinContainer decompress(const BinContainer& stream) //throw ZlibInternalError } } -#endif //SIMPLE_H_INCLUDED_18134135134135345489 +#endif //ZLIB_H_INCLUDED_428597064566 |