From bf1d680a75b491a1dec32c894bbca891f09f1d7e Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Tue, 25 Jul 2023 14:41:43 +0100 Subject: [PATCH] FuzzPDF: Initialize document so page count is accurate Without calling `initialize()`, the page count is 0, so the loop never ran and we never actually tested any of the code in `get_page()`. --- Meta/Lagom/Fuzzers/FuzzPDF.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Meta/Lagom/Fuzzers/FuzzPDF.cpp b/Meta/Lagom/Fuzzers/FuzzPDF.cpp index 7877c677ff..437beaa436 100644 --- a/Meta/Lagom/Fuzzers/FuzzPDF.cpp +++ b/Meta/Lagom/Fuzzers/FuzzPDF.cpp @@ -13,6 +13,7 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) if (auto maybe_document = PDF::Document::create(bytes); !maybe_document.is_error()) { auto document = maybe_document.release_value(); + (void)document->initialize(); auto pages = document->get_page_count(); for (size_t i = 0; i < pages; ++i) { (void)document->get_page(i);