1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:47:35 +00:00

LibArchive: Make TarInputStream::advance report errors

Fixes this bug that was reported by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52862
This commit is contained in:
implicitfield 2022-11-11 18:44:12 +02:00 committed by Andrew Kaster
parent 26a4327b06
commit c88d8a21cc
4 changed files with 18 additions and 8 deletions

View file

@ -98,7 +98,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return {};
};
for (; !tar_stream.finished(); tar_stream.advance()) {
while (!tar_stream.finished()) {
Archive::TarFileHeader const& header = tar_stream.header();
// Handle meta-entries earlier to avoid consuming the file content stream.
@ -198,6 +198,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
// Non-global headers should be cleared after every file.
local_overrides.clear();
auto maybe_error = tar_stream.advance();
if (maybe_error.is_error())
return maybe_error.error();
}
file_stream.close();