mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-27 12:46:06 +00:00
LibCompress: Check for impossible back references in DeflateDecompressor
This commit makes sure that we fail if an encoded lz77 back reference references bytes that are outside our sliding window, instead of just silently failing, which triggers an assertion down the line.
This commit is contained in:
parent
9e6d0dd879
commit
071ee7c6f4
Notes:
sideshowbarker
2024-07-18 21:16:22 +09:00
Author: https://github.com/IdanHo
Commit: 071ee7c6f4
Pull-request: https://github.com/SerenityOS/serenity/pull/5847
Issue: https://github.com/SerenityOS/serenity/issues/5838
Issue: https://github.com/SerenityOS/serenity/issues/5839
1 changed files with 4 additions and 0 deletions
|
@ -178,6 +178,10 @@ bool DeflateDecompressor::CompressedBlock::try_read_more()
|
|||
for (size_t idx = 0; idx < length; ++idx) {
|
||||
u8 byte = 0;
|
||||
m_decompressor.m_output_stream.read({ &byte, sizeof(byte) }, distance);
|
||||
if (m_decompressor.m_output_stream.handle_any_error()) {
|
||||
m_decompressor.set_fatal_error();
|
||||
return false; // a back reference was requested that was too far back (outside our current sliding window)
|
||||
}
|
||||
m_decompressor.m_output_stream << byte;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue