mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:47:34 +00:00
LibCompress: Move XZ header validation into the read function
The constructor is now only concerned with creating the required streams, which means that it no longer fails for XZ streams with invalid headers. Instead, everything is parsed and validated during the first read, preparing us for files with multiple streams.
This commit is contained in:
parent
1f166b3a15
commit
00332c9b7d
3 changed files with 19 additions and 14 deletions
|
@ -118,8 +118,9 @@ TEST_CASE(xz_utils_bad_0_header_magic)
|
|||
};
|
||||
|
||||
auto stream = MUST(try_make<FixedMemoryStream>(compressed));
|
||||
auto decompressor_or_error = Compress::XzDecompressor::create(move(stream));
|
||||
EXPECT(decompressor_or_error.is_error());
|
||||
auto decompressor = MUST(Compress::XzDecompressor::create(move(stream)));
|
||||
auto buffer_or_error = decompressor->read_until_eof(PAGE_SIZE);
|
||||
EXPECT(buffer_or_error.is_error());
|
||||
}
|
||||
|
||||
TEST_CASE(xz_utils_bad_0_nonempty_index)
|
||||
|
@ -695,8 +696,9 @@ TEST_CASE(xz_utils_bad_1_stream_flags_2)
|
|||
};
|
||||
|
||||
auto stream = MUST(try_make<FixedMemoryStream>(compressed));
|
||||
auto decompressor_or_error = Compress::XzDecompressor::create(move(stream));
|
||||
EXPECT(decompressor_or_error.is_error());
|
||||
auto decompressor = MUST(Compress::XzDecompressor::create(move(stream)));
|
||||
auto buffer_or_error = decompressor->read_until_eof(PAGE_SIZE);
|
||||
EXPECT(buffer_or_error.is_error());
|
||||
}
|
||||
|
||||
TEST_CASE(xz_utils_bad_1_stream_flags_3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue