1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:57:43 +00:00

Lagom/Fuzzers: Add fuzzer for PDF document

This commit is contained in:
Brendan Coles 2021-10-30 12:05:13 +00:00 committed by Brian Gianforcaro
parent 34cc4803af
commit 91de60d912
3 changed files with 31 additions and 0 deletions

View file

@ -0,0 +1,23 @@
/*
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibPDF/Document.h>
#include <stdint.h>
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();
for (size_t i = 0; i < pages; ++i) {
(void)doc->get_page(i);
}
}
return 0;
}