mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
LibCompress+AK: Propagate error handling to wrapped streams
This ensures that when a DeflateCompressor stream is cleared of any errors its underlying wrapped streams (InputBitStream/InputMemoryStream) will be cleared as well and wont fail a VERIFY on destruction.
This commit is contained in:
parent
f532421c9c
commit
a955fd4156
Notes:
sideshowbarker
2024-07-18 21:19:27 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/a955fd41561 Pull-request: https://github.com/SerenityOS/serenity/pull/5803 Issue: https://github.com/SerenityOS/serenity/issues/5682
3 changed files with 11 additions and 0 deletions
|
@ -116,6 +116,11 @@ public:
|
|||
m_next_byte.clear();
|
||||
}
|
||||
|
||||
bool handle_any_error() override
|
||||
{
|
||||
return m_stream.handle_any_error() || Stream::handle_any_error();
|
||||
}
|
||||
|
||||
private:
|
||||
Optional<u8> m_next_byte;
|
||||
size_t m_bit_offset { 0 };
|
||||
|
|
|
@ -321,6 +321,11 @@ bool DeflateDecompressor::discard_or_error(size_t count)
|
|||
|
||||
bool DeflateDecompressor::unreliable_eof() const { return m_state == State::Idle && m_read_final_bock; }
|
||||
|
||||
bool DeflateDecompressor::handle_any_error()
|
||||
{
|
||||
return m_input_stream.handle_any_error() || Stream::handle_any_error();
|
||||
}
|
||||
|
||||
Optional<ByteBuffer> DeflateDecompressor::decompress_all(ReadonlyBytes bytes)
|
||||
{
|
||||
InputMemoryStream memory_stream { bytes };
|
||||
|
|
|
@ -102,6 +102,7 @@ public:
|
|||
bool discard_or_error(size_t) override;
|
||||
|
||||
bool unreliable_eof() const override;
|
||||
bool handle_any_error() override;
|
||||
|
||||
static Optional<ByteBuffer> decompress_all(ReadonlyBytes);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue