summaryrefslogtreecommitdiff
path: root/Meta/Lagom/Fuzzers
diff options
context:
space:
mode:
authorMatthew Olsson <matthewcolsson@gmail.com>2022-03-05 17:30:55 -0700
committerAndreas Kling <kling@serenityos.org>2022-03-07 10:53:57 +0100
commit73cf8205b47d2ca6f0dc01025b84ac31271f7526 (patch)
tree02965c39127215e112f8c6459ba5bb3a84ec435f /Meta/Lagom/Fuzzers
parent7e1c823725c085e1efb796dfe98fca8f7d7857b7 (diff)
downloadserenity-73cf8205b47d2ca6f0dc01025b84ac31271f7526.zip
LibPDF: Propagate errors in Parser and Document
Diffstat (limited to 'Meta/Lagom/Fuzzers')
-rw-r--r--Meta/Lagom/Fuzzers/FuzzPDF.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Meta/Lagom/Fuzzers/FuzzPDF.cpp b/Meta/Lagom/Fuzzers/FuzzPDF.cpp
index 733fcb7e5c..b2eb5e701f 100644
--- a/Meta/Lagom/Fuzzers/FuzzPDF.cpp
+++ b/Meta/Lagom/Fuzzers/FuzzPDF.cpp
@@ -10,12 +10,12 @@
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
ReadonlyBytes bytes { data, size };
- auto doc = PDF::Document::create(bytes);
- if (doc) {
- auto pages = doc->get_page_count();
+ if (auto maybe_document = PDF::Document::create(bytes); !maybe_document.is_error()) {
+ auto document = maybe_document.release_value();
+ auto pages = document->get_page_count();
for (size_t i = 0; i < pages; ++i) {
- (void)doc->get_page(i);
+ (void)document->get_page(i);
}
}