1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 15:47:34 +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

@ -16,7 +16,7 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
if (!tar_stream.valid())
return 0;
for (; !tar_stream.finished(); tar_stream.advance()) {
while (!tar_stream.finished()) {
auto const& header = tar_stream.header();
if (!header.content_is_like_extended_header())
@ -33,6 +33,10 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
default:
return 0;
}
auto maybe_error = tar_stream.advance();
if (maybe_error.is_error())
return 0;
}
return 0;