mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 18:24:45 -05:00
bf1d680a75
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()`.
24 lines
619 B
C++
24 lines
619 B
C++
/*
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibPDF/Document.h>
|
|
#include <stdint.h>
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
|
|
{
|
|
ReadonlyBytes bytes { data, 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);
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|