1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

LibCompress: Implement support for multiple concatenated XZ streams

This commit is contained in:
Tim Schumacher 2023-03-30 13:16:40 +02:00 committed by Andreas Kling
parent 00332c9b7d
commit 726963edc7
Notes: sideshowbarker 2024-07-17 01:04:03 +09:00
3 changed files with 62 additions and 13 deletions

View file

@ -39,8 +39,8 @@ TEST_CASE(xz_utils_bad_0cat_alone)
auto stream = MUST(try_make<FixedMemoryStream>(compressed));
auto decompressor = MUST(Compress::XzDecompressor::create(move(stream)));
// TODO: We currently don't support XZ files with multiple concatenated streams, so we don't check for trailing garbage either.
(void)decompressor->read_until_eof(PAGE_SIZE);
auto buffer_or_error = decompressor->read_until_eof(PAGE_SIZE);
EXPECT(buffer_or_error.is_error());
}
TEST_CASE(xz_utils_bad_0cat_header_magic)
@ -56,8 +56,8 @@ TEST_CASE(xz_utils_bad_0cat_header_magic)
auto stream = MUST(try_make<FixedMemoryStream>(compressed));
auto decompressor = MUST(Compress::XzDecompressor::create(move(stream)));
// TODO: We currently don't support XZ files with multiple concatenated streams, so we don't check for the second header magic.
(void)decompressor->read_until_eof(PAGE_SIZE);
auto buffer_or_error = decompressor->read_until_eof(PAGE_SIZE);
EXPECT(buffer_or_error.is_error());
}
TEST_CASE(xz_utils_bad_0catpad_empty)
@ -74,8 +74,8 @@ TEST_CASE(xz_utils_bad_0catpad_empty)
auto stream = MUST(try_make<FixedMemoryStream>(compressed));
auto decompressor = MUST(Compress::XzDecompressor::create(move(stream)));
// TODO: We currently don't support XZ files with multiple concatenated streams, so we don't check for the stream padding.
(void)decompressor->read_until_eof(PAGE_SIZE);
auto buffer_or_error = decompressor->read_until_eof(PAGE_SIZE);
EXPECT(buffer_or_error.is_error());
}
TEST_CASE(xz_utils_bad_0_empty_truncated)
@ -151,8 +151,8 @@ TEST_CASE(xz_utils_bad_0pad_empty)
auto stream = MUST(try_make<FixedMemoryStream>(compressed));
auto decompressor = MUST(Compress::XzDecompressor::create(move(stream)));
// TODO: We currently don't support XZ files with multiple concatenated streams, so we don't check for the stream padding.
(void)decompressor->read_until_eof(PAGE_SIZE);
auto buffer_or_error = decompressor->read_until_eof(PAGE_SIZE);
EXPECT(buffer_or_error.is_error());
}
TEST_CASE(xz_utils_bad_1_block_header_1)