mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 02:27:44 +00:00
LibCompress/Brotli: Update the lookback buffer with uncompressed data
We previously skipped updating the lookback buffer when copying uncompressed data, which resulted in a wrong total byte count. With a wrong total byte count, our decompressor implementation ended up choosing a wrong offset into the dictionary.
This commit is contained in:
parent
c3167afa3a
commit
707a36dd79
2 changed files with 61 additions and 0 deletions
|
@ -735,6 +735,10 @@ ErrorOr<Bytes> BrotliDecompressionStream::read_some(Bytes output_buffer)
|
|||
if (uncompressed_bytes.is_empty())
|
||||
return Error::from_string_literal("eof");
|
||||
|
||||
// TODO: Replace the home-grown LookbackBuffer with AK::CircularBuffer.
|
||||
for (auto c : uncompressed_bytes)
|
||||
m_lookback_buffer.value().write(c);
|
||||
|
||||
m_bytes_left -= uncompressed_bytes.size();
|
||||
bytes_read += uncompressed_bytes.size();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue