mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09:00
LibCompress: Avoid buffer overrun when building canonical Huffman code
Previously, decompressing a DEFLATE stream an invalid canonical Huffman code could cause a buffer overrun. We now return an error in this case.
This commit is contained in:
parent
bc6638682d
commit
2f26a7bb12
Notes:
sideshowbarker
2024-07-17 22:41:14 +09:00
Author: https://github.com/tcl3
Commit: 2f26a7bb12
Pull-request: https://github.com/SerenityOS/serenity/pull/21391
Reviewed-by: https://github.com/timschumi ✅
2 changed files with 10 additions and 0 deletions
|
@ -55,6 +55,13 @@ TEST_CASE(canonical_code_complex)
|
|||
EXPECT_EQ(MUST(huffman.read_symbol(bit_stream)), output[idx]);
|
||||
}
|
||||
|
||||
TEST_CASE(invalid_canonical_code)
|
||||
{
|
||||
Array<u8, 257> code;
|
||||
code.fill(0x08);
|
||||
EXPECT(Compress::CanonicalCode::from_bytes(code).is_error());
|
||||
}
|
||||
|
||||
TEST_CASE(deflate_decompress_compressed_block)
|
||||
{
|
||||
Array<u8, 28> const compressed {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue