summaryrefslogtreecommitdiff
path: root/Meta/Lagom
diff options
context:
space:
mode:
authorimplicitfield <114500360+implicitfield@users.noreply.github.com>2022-11-11 18:44:12 +0200
committerAndrew Kaster <andrewdkaster@gmail.com>2022-11-13 17:37:26 -0700
commitc88d8a21cc0ccc9080479bdb7020441c0a6ded4f (patch)
treeeb2283839fccf6f568cc82dfcb9e2e2736cb74ba /Meta/Lagom
parent26a4327b06fbdd186f8fac4181e94aefc1811fed (diff)
downloadserenity-c88d8a21cc0ccc9080479bdb7020441c0a6ded4f.zip
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
Diffstat (limited to 'Meta/Lagom')
-rw-r--r--Meta/Lagom/Fuzzers/FuzzTar.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Meta/Lagom/Fuzzers/FuzzTar.cpp b/Meta/Lagom/Fuzzers/FuzzTar.cpp
index 02d89b14a2..45d4cd9a02 100644
--- a/Meta/Lagom/Fuzzers/FuzzTar.cpp
+++ b/Meta/Lagom/Fuzzers/FuzzTar.cpp
@@ -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;