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()`.
This commit is contained in:
Sam Atkins 2023-07-25 14:41:43 +01:00 committed by Tim Flynn
parent 5028223c37
commit bf1d680a75
Notes: sideshowbarker 2024-07-16 23:34:49 +09:00

View file

@ -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);