Move PDFium libfuzzers to pdf/pdfium/fuzzers.
Also adds a JPX fuzzer. BUG=591789 Review URL: https://codereview.chromium.org/1820353002 Cr-Commit-Position: refs/heads/master@{#383072}
This commit is contained in:
pdf
testing/libfuzzer/fuzzers
@ -42,7 +42,10 @@ static_library("pdf") {
|
||||
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
|
||||
|
||||
if (pdf_engine == 0) {
|
||||
deps += [ "//third_party/pdfium" ]
|
||||
deps += [
|
||||
"//pdf/pdfium/fuzzers",
|
||||
"//third_party/pdfium",
|
||||
]
|
||||
|
||||
sources += [
|
||||
"pdfium/pdfium_api_string_buffer_adapter.cc",
|
||||
|
54
pdf/pdfium/fuzzers/BUILD.gn
Normal file
54
pdf/pdfium/fuzzers/BUILD.gn
Normal file
@ -0,0 +1,54 @@
|
||||
# Copyright 2016 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# PDFium fuzzers.
|
||||
|
||||
import("//third_party/pdfium/pdfium.gni")
|
||||
import("//testing/test.gni")
|
||||
import("//testing/libfuzzer/fuzzer_test.gni")
|
||||
|
||||
group("fuzzers") {
|
||||
}
|
||||
|
||||
fuzzer_test("pdfium_fuzzer") {
|
||||
sources = [
|
||||
"pdfium_fuzzer.cc",
|
||||
]
|
||||
deps = [
|
||||
"//third_party/pdfium",
|
||||
"//third_party/pdfium:test_support",
|
||||
"//v8",
|
||||
"//v8:v8_libplatform",
|
||||
]
|
||||
additional_configs = [
|
||||
"//third_party/pdfium:pdfium_config",
|
||||
"//v8:external_startup_data",
|
||||
]
|
||||
dict = "dicts/pdf.dict"
|
||||
}
|
||||
|
||||
fuzzer_test("pdf_jpx_fuzzer") {
|
||||
sources = []
|
||||
deps = [
|
||||
"//third_party/pdfium/testing/libfuzzer:pdf_jpx_fuzzer",
|
||||
]
|
||||
}
|
||||
|
||||
if (pdf_enable_xfa) {
|
||||
fuzzer_test("pdf_fm2js_fuzzer") {
|
||||
sources = []
|
||||
deps = [
|
||||
"//third_party/pdfium/testing/libfuzzer:pdf_fm2js_fuzzer",
|
||||
]
|
||||
dict = "dicts/pdf_fm2js.dict"
|
||||
}
|
||||
|
||||
fuzzer_test("pdf_xml_fuzzer") {
|
||||
sources = []
|
||||
deps = [
|
||||
"//third_party/pdfium/testing/libfuzzer:pdf_xml_fuzzer",
|
||||
]
|
||||
dict = "dicts/pdf_xml.dict"
|
||||
}
|
||||
}
|
3
pdf/pdfium/fuzzers/DEPS
Normal file
3
pdf/pdfium/fuzzers/DEPS
Normal file
@ -0,0 +1,3 @@
|
||||
include_rules = [
|
||||
"+third_party/pdfium/testing/test_support.h"
|
||||
]
|
@ -33,21 +33,23 @@
|
||||
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
static int ExampleAppAlert(IPDF_JSPLATFORM*, FPDF_WIDESTRING, FPDF_WIDESTRING,
|
||||
int, int) {
|
||||
static int ExampleAppAlert(IPDF_JSPLATFORM*,
|
||||
FPDF_WIDESTRING,
|
||||
FPDF_WIDESTRING,
|
||||
int,
|
||||
int) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ExampleDocGotoPage(IPDF_JSPLATFORM*, int pageNumber) { }
|
||||
|
||||
static void ExampleUnsupportedHandler(UNSUPPORT_INFO*, int type) { }
|
||||
static void ExampleDocGotoPage(IPDF_JSPLATFORM*, int pageNumber) {}
|
||||
|
||||
static void ExampleUnsupportedHandler(UNSUPPORT_INFO*, int type) {}
|
||||
|
||||
FPDF_BOOL Is_Data_Avail(FX_FILEAVAIL* pThis, size_t offset, size_t size) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static void Add_Segment(FX_DOWNLOADHINTS* pThis, size_t offset, size_t size) { }
|
||||
static void Add_Segment(FX_DOWNLOADHINTS* pThis, size_t offset, size_t size) {}
|
||||
|
||||
static bool RenderPage(const FPDF_DOCUMENT& doc,
|
||||
const FPDF_FORMHANDLE& form,
|
||||
@ -192,7 +194,7 @@ std::string ProgramPath() {
|
||||
struct TestCase {
|
||||
TestCase() {
|
||||
InitializeV8ForPDFium(ProgramPath(), "", &natives_blob, &snapshot_blob,
|
||||
&platform);
|
||||
&platform);
|
||||
|
||||
memset(&config, '\0', sizeof(config));
|
||||
config.version = 2;
|
@ -7,7 +7,6 @@
|
||||
import("//build/config/features.gni")
|
||||
import("//media/media_options.gni")
|
||||
import("//testing/libfuzzer/fuzzer_test.gni")
|
||||
import("//third_party/pdfium/pdfium.gni")
|
||||
|
||||
# root BUILD depenends on this target. Needed for package discovery
|
||||
group("fuzzers") {
|
||||
@ -171,41 +170,6 @@ fuzzer_test("zlib_uncompress_fuzzer") {
|
||||
]
|
||||
}
|
||||
|
||||
fuzzer_test("pdfium_fuzzer") {
|
||||
sources = [
|
||||
"pdfium_fuzzer.cc",
|
||||
]
|
||||
deps = [
|
||||
"//third_party/pdfium",
|
||||
"//third_party/pdfium:test_support",
|
||||
"//v8",
|
||||
"//v8:v8_libplatform",
|
||||
]
|
||||
additional_configs = [
|
||||
"//third_party/pdfium:pdfium_config",
|
||||
"//v8:external_startup_data",
|
||||
]
|
||||
dict = "dicts/pdf.dict"
|
||||
}
|
||||
|
||||
if (pdf_enable_xfa) {
|
||||
fuzzer_test("pdf_fm2js_fuzzer") {
|
||||
sources = []
|
||||
deps = [
|
||||
"//third_party/pdfium/testing/libfuzzer:pdf_fm2js_fuzzer",
|
||||
]
|
||||
dict = "dicts/pdf_fm2js.dict"
|
||||
}
|
||||
|
||||
fuzzer_test("pdf_xml_fuzzer") {
|
||||
sources = []
|
||||
deps = [
|
||||
"//third_party/pdfium/testing/libfuzzer:pdf_xml_fuzzer",
|
||||
]
|
||||
dict = "dicts/pdf_xml.dict"
|
||||
}
|
||||
}
|
||||
|
||||
fuzzer_test("sqlite3_prepare_v2_fuzzer") {
|
||||
sources = [
|
||||
"sqlite3_prepare_v2_fuzzer.cc",
|
||||
|
Reference in New Issue
Block a user