2021-10-30 12:05:13 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <LibPDF/Document.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2022-04-01 20:58:27 +03:00
|
|
|
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
|
2021-10-30 12:05:13 +00:00
|
|
|
{
|
2023-11-03 17:49:54 +00:00
|
|
|
AK::set_debug_enabled(false);
|
|
|
|
|
2021-10-30 12:05:13 +00:00
|
|
|
ReadonlyBytes bytes { data, size };
|
|
|
|
|
2022-03-05 17:30:55 -07:00
|
|
|
if (auto maybe_document = PDF::Document::create(bytes); !maybe_document.is_error()) {
|
|
|
|
auto document = maybe_document.release_value();
|
2023-07-25 14:41:43 +01:00
|
|
|
(void)document->initialize();
|
2022-03-05 17:30:55 -07:00
|
|
|
auto pages = document->get_page_count();
|
2021-10-30 12:05:13 +00:00
|
|
|
for (size_t i = 0; i < pages; ++i) {
|
2022-03-05 17:30:55 -07:00
|
|
|
(void)document->get_page(i);
|
2021-10-30 12:05:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|