summaryrefslogtreecommitdiff
path: root/Tests/LibCompress
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2023-03-30 12:14:07 +0200
committerAndreas Kling <kling@serenityos.org>2023-03-30 14:38:47 +0200
commit00332c9b7d52d444c4c84af49d542c983a0231ac (patch)
treef63b155374d3b23dd1d523f5a4bb9a17162108d1 /Tests/LibCompress
parent1f166b3a15b38e1ee065905d4e99401ba39b9f8e (diff)
downloadserenity-00332c9b7d52d444c4c84af49d542c983a0231ac.zip
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.
Diffstat (limited to 'Tests/LibCompress')
-rw-r--r--Tests/LibCompress/TestXz.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Tests/LibCompress/TestXz.cpp b/Tests/LibCompress/TestXz.cpp
index 8bb6af4f01..ec8dc31f1f 100644
--- a/Tests/LibCompress/TestXz.cpp
+++ b/Tests/LibCompress/TestXz.cpp
@@ -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)