summaryrefslogtreecommitdiff
path: root/Userland/Utilities/tar.cpp
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 /Userland/Utilities/tar.cpp
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 'Userland/Utilities/tar.cpp')
-rw-r--r--Userland/Utilities/tar.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Utilities/tar.cpp b/Userland/Utilities/tar.cpp
index a165abcebe..0e952fb142 100644
--- a/Userland/Utilities/tar.cpp
+++ b/Userland/Utilities/tar.cpp
@@ -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();