mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:37:34 +00:00
LibCompress: Make the Zlib decompressor fail gracefuly
This commit adds a verify-less try_create method to the Zlib decompressor to allow for graceful failures of parsing the Zlib headers.
This commit is contained in:
parent
a7b5a58509
commit
f532421c9c
2 changed files with 33 additions and 19 deletions
|
@ -34,21 +34,22 @@ namespace Compress {
|
|||
|
||||
class Zlib {
|
||||
public:
|
||||
Zlib(ReadonlyBytes data);
|
||||
|
||||
Optional<ByteBuffer> decompress();
|
||||
u32 checksum();
|
||||
|
||||
static Optional<Zlib> try_create(ReadonlyBytes data);
|
||||
static Optional<ByteBuffer> decompress_all(ReadonlyBytes);
|
||||
|
||||
private:
|
||||
Zlib(const ReadonlyBytes& data);
|
||||
|
||||
u8 m_compression_method;
|
||||
u8 m_compression_info;
|
||||
u8 m_check_bits;
|
||||
u8 m_has_dictionary;
|
||||
u8 m_compression_level;
|
||||
|
||||
u32 m_checksum;
|
||||
u32 m_checksum { 0 };
|
||||
ReadonlyBytes m_input_data;
|
||||
ReadonlyBytes m_data_bytes;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue