mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:07:35 +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
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