blob: bef289315c3bcd7951632cbacf20b8ce572d0117 [file] [log] [blame]
# 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.
# When adding a fuzzer_test target make sure to add it to the group
# 'pdf_fuzzers'
import("//testing/libfuzzer/fuzzer_test.gni")
import("//testing/test.gni")
import("//third_party/pdfium/pdfium.gni")
import("//third_party/protobuf/proto_library.gni")
group("fuzzers") {
}
group("pdf_fuzzers") {
testonly = true
deps = [
":pdf_cmap_fuzzer",
":pdf_codec_a85_fuzzer",
":pdf_codec_fax_fuzzer",
":pdf_codec_icc_fuzzer",
":pdf_codec_jbig2_fuzzer",
":pdf_codec_rle_fuzzer",
":pdf_font_fuzzer",
":pdf_hint_table_fuzzer",
":pdf_jpx_fuzzer",
":pdf_psengine_fuzzer",
":pdf_scanlinecompositor_fuzzer",
":pdf_streamparser_fuzzer",
":pdf_xml_fuzzer",
":pdfium_fuzzer",
]
if (pdf_enable_v8) {
deps += [
":pdf_cjs_util_fuzzer",
":pdf_fx_date_helpers_fuzzer",
]
if (pdf_enable_xfa) {
deps += [
":pdf_bidi_fuzzer",
":pdf_cfgas_stringformatter_fuzzer",
":pdf_cfx_barcode_fuzzer",
":pdf_codec_jpeg_fuzzer",
":pdf_css_fuzzer",
":pdf_fm2js_fuzzer",
":pdf_formcalc_context_fuzzer",
":pdf_formcalc_fuzzer",
":pdfium_xfa_fuzzer",
":pdfium_xfa_lpm_fuzzer",
]
if (pdf_enable_xfa_bmp) {
deps += [ ":pdf_codec_bmp_fuzzer" ]
}
if (pdf_enable_xfa_gif) {
deps += [
":pdf_codec_gif_fuzzer",
":pdf_lzw_fuzzer",
]
}
if (pdf_enable_xfa_png) {
deps += [ ":pdf_codec_png_fuzzer" ]
}
if (pdf_enable_xfa_tiff) {
deps += [ ":pdf_codec_tiff_fuzzer" ]
}
}
}
if (is_clang) {
deps += [ ":pdf_nametree_fuzzer" ]
}
}
fuzzer_test("pdfium_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdfium_fuzzer_src" ]
dict = "dicts/pdf.dict"
seed_corpus = "//third_party/pdfium/testing/resources"
grammar_options = [ "grammar=PDF" ]
}
fuzzer_test("pdf_cmap_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_cmap_fuzzer_src" ]
}
fuzzer_test("pdf_codec_a85_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_codec_a85_fuzzer_src" ]
}
fuzzer_test("pdf_codec_fax_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_codec_fax_fuzzer_src" ]
}
fuzzer_test("pdf_codec_rle_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_codec_rle_fuzzer_src" ]
}
fuzzer_test("pdf_codec_icc_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_codec_icc_fuzzer_src" ]
dict = "dicts/pdf_codec_icc.dict"
}
fuzzer_test("pdf_codec_jbig2_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_codec_jbig2_fuzzer_src" ]
}
fuzzer_test("pdf_font_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_font_fuzzer_src" ]
}
fuzzer_test("pdf_hint_table_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_hint_table_fuzzer_src" ]
}
fuzzer_test("pdf_jpx_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_jpx_fuzzer_src" ]
seed_corpus = "corpora/pdf_jpx"
}
fuzzer_test("pdf_psengine_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_psengine_fuzzer_src" ]
}
fuzzer_test("pdf_scanlinecompositor_fuzzer") {
sources = []
deps = [
"//third_party/pdfium/testing/fuzzers:pdf_scanlinecompositor_fuzzer_src",
]
}
fuzzer_test("pdf_streamparser_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_streamparser_fuzzer_src" ]
}
fuzzer_test("pdf_xml_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_xml_fuzzer_src" ]
dict = "dicts/pdf_xml.dict"
seed_corpus = "//third_party/libxml/fuzz/seed_corpus"
}
if (pdf_enable_v8) {
fuzzer_test("pdf_cjs_util_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_cjs_util_fuzzer_src" ]
}
fuzzer_test("pdf_fx_date_helpers_fuzzer") {
sources = []
deps = [
"//third_party/pdfium/testing/fuzzers:pdf_fx_date_helpers_fuzzer_src",
]
}
if (pdf_enable_xfa) {
if (pdf_enable_xfa_bmp) {
fuzzer_test("pdf_codec_bmp_fuzzer") {
sources = []
deps =
[ "//third_party/pdfium/testing/fuzzers:pdf_codec_bmp_fuzzer_src" ]
seed_corpus = "corpora/pdf_codec_bmp"
}
}
if (pdf_enable_xfa_gif) {
fuzzer_test("pdf_codec_gif_fuzzer") {
sources = []
deps =
[ "//third_party/pdfium/testing/fuzzers:pdf_codec_gif_fuzzer_src" ]
dict = "dicts/pdf_codec_gif.dict"
seed_corpus = "corpora/pdf_codec_gif"
}
}
fuzzer_test("pdf_codec_jpeg_fuzzer") {
sources = []
deps =
[ "//third_party/pdfium/testing/fuzzers:pdf_codec_jpeg_fuzzer_src" ]
dict = "dicts/pdf_codec_jpeg.dict"
seed_corpus = "corpora/pdf_codec_jpeg"
}
if (pdf_enable_xfa_png) {
fuzzer_test("pdf_codec_png_fuzzer") {
sources = []
deps =
[ "//third_party/pdfium/testing/fuzzers:pdf_codec_png_fuzzer_src" ]
dict = "dicts/pdf_codec_png.dict"
seed_corpuses = [
"corpora/pdf_codec_png",
"//components/viz/test/data",
"//third_party/blink/web_tests/images/png-suite/samples",
"//third_party/blink/web_tests/images/resources/pngfuzz",
]
}
}
if (pdf_enable_xfa_tiff) {
fuzzer_test("pdf_codec_tiff_fuzzer") {
sources = []
deps =
[ "//third_party/pdfium/testing/fuzzers:pdf_codec_tiff_fuzzer_src" ]
dict = "dicts/pdf_codec_tiff.dict"
seed_corpus = "corpora/pdf_codec_tiff"
}
}
fuzzer_test("pdf_css_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_css_fuzzer_src" ]
dict = "dicts/pdf_css.dict"
}
fuzzer_test("pdf_fm2js_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_fm2js_fuzzer_src" ]
dict = "dicts/pdf_formcalc.dict"
}
fuzzer_test("pdf_formcalc_context_fuzzer") {
sources = []
deps = [
"//third_party/pdfium/testing/fuzzers:pdf_formcalc_context_fuzzer_src",
]
dict = "dicts/pdf_xfa_js.dict"
}
fuzzer_test("pdf_formcalc_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_formcalc_fuzzer_src" ]
dict = "dicts/pdf_formcalc.dict"
}
if (pdf_enable_xfa_gif) {
fuzzer_test("pdf_lzw_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_lzw_fuzzer_src" ]
}
}
fuzzer_test("pdf_bidi_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_bidi_fuzzer_src" ]
}
fuzzer_test("pdf_cfx_barcode_fuzzer") {
sources = []
deps =
[ "//third_party/pdfium/testing/fuzzers:pdf_cfx_barcode_fuzzer_src" ]
}
fuzzer_test("pdf_cfgas_stringformatter_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_cfgas_stringformatter_fuzzer_src" ]
}
fuzzer_test("pdfium_xfa_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdfium_xfa_fuzzer_src" ]
dict = "dicts/pdf.dict"
seed_corpus = "corpora/xfa"
grammar_options = [ "grammar=PDF" ]
}
static_library("proto_to_xfa") {
sources = [
"pdfium_xfa_lpm_fuzzer/proto_to_xfa.cc",
"pdfium_xfa_lpm_fuzzer/proto_to_xfa.h",
"pdfium_xfa_lpm_fuzzer/simple_xfa_pdf.cc",
"pdfium_xfa_lpm_fuzzer/simple_xfa_pdf.h",
]
deps = [
":xfa_proto",
"//base",
]
}
fuzzer_test("pdfium_xfa_lpm_fuzzer") {
sources = [ "pdfium_xfa_lpm_fuzzer/fuzzer.cc" ]
deps = [
":proto_to_xfa",
"//base",
"//third_party/libprotobuf-mutator",
"//third_party/pdfium",
"//third_party/pdfium/testing/fuzzers:fuzzer_init_public",
]
if (!is_component_build) {
deps +=
[ "//third_party/pdfium/testing/fuzzers:pdfium_xfa_lpm_fuzzer_src" ]
}
include_dirs = [ "//third_party/pdfium" ]
# Don't build the fuzzer while it isn't actually producing XFA.
# TODO(metzman): Remove this once the fuzzer actually fuzzes XFA.
additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ]
}
test("pdfium_xfa_lpm_unittest") {
sources = [ "pdfium_xfa_lpm_fuzzer/simple_xfa_pdf_unittest.cc" ]
deps = [
":proto_to_xfa",
"//base/test:run_all_unittests",
"//testing/gtest",
]
}
}
}
if (is_clang) {
fuzzer_test("pdf_nametree_fuzzer") {
sources = []
deps = [ "//third_party/pdfium/testing/fuzzers:pdf_nametree_fuzzer_src" ]
}
}
proto_library("xfa_proto") {
sources = [ "pdfium_xfa_lpm_fuzzer/xfa.proto" ]
}