mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:37:46 +00:00
LibCompress: fail gracefuly on invalid symbols in DeflateDecompressor
This commit is contained in:
parent
071ee7c6f4
commit
ea7bdf02b8
1 changed files with 2 additions and 2 deletions
|
@ -150,7 +150,7 @@ bool DeflateDecompressor::CompressedBlock::try_read_more()
|
|||
|
||||
const auto symbol = m_literal_codes.read_symbol(m_decompressor.m_input_stream);
|
||||
|
||||
if (symbol == UINT32_MAX) {
|
||||
if (symbol >= 286) { // invalid deflate literal/length symbol
|
||||
m_decompressor.set_fatal_error();
|
||||
return false;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ bool DeflateDecompressor::CompressedBlock::try_read_more()
|
|||
|
||||
const auto length = m_decompressor.decode_length(symbol);
|
||||
const auto distance_symbol = m_distance_codes.value().read_symbol(m_decompressor.m_input_stream);
|
||||
if (distance_symbol == UINT32_MAX) {
|
||||
if (distance_symbol >= 30) { // invalid deflate distance symbol
|
||||
m_decompressor.set_fatal_error();
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue