2018-12-22 09:09:53 +00:00
|
|
|
#include "qpdf/qpdf-c.h"
|
|
|
|
|
2018-12-27 19:13:11 +00:00
|
|
|
#include <algorithm>
|
2018-12-22 09:09:53 +00:00
|
|
|
#include <cstddef>
|
|
|
|
#include <cstdint>
|
|
|
|
#include <cstdlib>
|
|
|
|
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
2018-12-27 19:13:11 +00:00
|
|
|
constexpr size_t kMaxSize = 64 * 1024; // 64 KiB
|
|
|
|
size = std::min(size, kMaxSize);
|
2018-12-22 09:09:53 +00:00
|
|
|
_qpdf_data* qpdf = qpdf_init();
|
|
|
|
const char* buffer = reinterpret_cast<const char*>(data);
|
|
|
|
qpdf_read_memory(qpdf, /*description=*/"", buffer, size, /*password=*/"");
|
|
|
|
qpdf_cleanup(&qpdf);
|
|
|
|
return 0;
|
|
|
|
}
|