#include "testing/fuzzers/pdfium_fuzzer_helper.h"
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include "core/fxcrt/check_op.h"
#include "core/fxcrt/compiler_specific.h"
#include "core/fxcrt/fx_memcpy_wrappers.h"
#include "core/fxcrt/numerics/checked_math.h"
#include "core/fxcrt/span.h"
#include "public/cpp/fpdf_scopers.h"
#include "public/fpdf_dataavail.h"
#include "public/fpdf_ext.h"
#include "public/fpdf_text.h"
namespace {
class FuzzerTestLoader { … };
int ExampleAppAlert(IPDF_JSPLATFORM*,
FPDF_WIDESTRING,
FPDF_WIDESTRING,
int,
int) { … }
int ExampleAppResponse(IPDF_JSPLATFORM*,
FPDF_WIDESTRING question,
FPDF_WIDESTRING title,
FPDF_WIDESTRING default_value,
FPDF_WIDESTRING label,
FPDF_BOOL is_password,
void* response,
int length) { … }
void ExampleDocGotoPage(IPDF_JSPLATFORM*, int pageNumber) { … }
void ExampleDocMail(IPDF_JSPLATFORM*,
void* mailData,
int length,
FPDF_BOOL UI,
FPDF_WIDESTRING To,
FPDF_WIDESTRING Subject,
FPDF_WIDESTRING CC,
FPDF_WIDESTRING BCC,
FPDF_WIDESTRING Msg) { … }
FPDF_BOOL Is_Data_Avail(FX_FILEAVAIL* pThis, size_t offset, size_t size) { … }
void Add_Segment(FX_DOWNLOADHINTS* pThis, size_t offset, size_t size) { … }
std::pair<int, int> GetRenderingAndFormFlagFromData(const char* data,
size_t len) { … }
}
PDFiumFuzzerHelper::PDFiumFuzzerHelper() = default;
PDFiumFuzzerHelper::~PDFiumFuzzerHelper() = default;
bool PDFiumFuzzerHelper::OnFormFillEnvLoaded(FPDF_DOCUMENT doc) { … }
void PDFiumFuzzerHelper::RenderPdf(const char* data, size_t len) { … }
bool PDFiumFuzzerHelper::RenderPage(FPDF_DOCUMENT doc,
FPDF_FORMHANDLE form,
int page_index,
int render_flags,
int form_flags) { … }