123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- # 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")
- template("pdfium_fuzzer_test") {
- fuzzer_test(target_name) {
- forward_variables_from(invoker, "*", [ "deps" ])
- sources = []
- deps = [ "//third_party/pdfium/testing/fuzzers:${target_name}_src" ]
- if (is_component_build) {
- deps += [ "//third_party/pdfium/testing/fuzzers:${target_name}_impl" ]
- }
- if (defined(invoker.deps)) {
- deps += invoker.deps
- }
- }
- }
- 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_formcalc_context_fuzzer",
- ":pdf_formcalc_fuzzer",
- ":pdf_formcalc_translate_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_cpdf_tounicodemap_fuzzer",
- ":pdf_nametree_fuzzer",
- ]
- if (pdf_enable_xfa) {
- deps += [
- ":pdf_xfa_fdp_fuzzer",
- ":pdf_xfa_raw_fuzzer",
- ":pdf_xfa_xdp_fdp_fuzzer",
- ]
- }
- }
- }
- pdfium_fuzzer_test("pdfium_fuzzer") {
- dict = "dicts/pdf.dict"
- seed_corpus = "//third_party/pdfium/testing/resources"
- grammar_options = [ "grammar=PDF" ]
- }
- pdfium_fuzzer_test("pdf_cmap_fuzzer") {
- }
- pdfium_fuzzer_test("pdf_codec_a85_fuzzer") {
- }
- pdfium_fuzzer_test("pdf_codec_fax_fuzzer") {
- }
- pdfium_fuzzer_test("pdf_codec_rle_fuzzer") {
- }
- pdfium_fuzzer_test("pdf_codec_icc_fuzzer") {
- dict = "dicts/pdf_codec_icc.dict"
- }
- pdfium_fuzzer_test("pdf_codec_jbig2_fuzzer") {
- }
- pdfium_fuzzer_test("pdf_font_fuzzer") {
- }
- pdfium_fuzzer_test("pdf_hint_table_fuzzer") {
- }
- pdfium_fuzzer_test("pdf_jpx_fuzzer") {
- seed_corpus = "corpora/pdf_jpx"
- }
- pdfium_fuzzer_test("pdf_psengine_fuzzer") {
- }
- pdfium_fuzzer_test("pdf_scanlinecompositor_fuzzer") {
- }
- pdfium_fuzzer_test("pdf_streamparser_fuzzer") {
- }
- pdfium_fuzzer_test("pdf_xml_fuzzer") {
- dict = "dicts/pdf_xml.dict"
- seed_corpus = "//third_party/libxml/fuzz/seed_corpus"
- }
- if (pdf_enable_v8) {
- pdfium_fuzzer_test("pdf_cjs_util_fuzzer") {
- }
- pdfium_fuzzer_test("pdf_fx_date_helpers_fuzzer") {
- }
- if (pdf_enable_xfa) {
- if (pdf_enable_xfa_bmp) {
- pdfium_fuzzer_test("pdf_codec_bmp_fuzzer") {
- seed_corpus = "corpora/pdf_codec_bmp"
- }
- }
- if (pdf_enable_xfa_gif) {
- pdfium_fuzzer_test("pdf_codec_gif_fuzzer") {
- dict = "dicts/pdf_codec_gif.dict"
- seed_corpus = "corpora/pdf_codec_gif"
- }
- }
- pdfium_fuzzer_test("pdf_codec_jpeg_fuzzer") {
- dict = "dicts/pdf_codec_jpeg.dict"
- seed_corpus = "corpora/pdf_codec_jpeg"
- }
- if (pdf_enable_xfa_png) {
- pdfium_fuzzer_test("pdf_codec_png_fuzzer") {
- 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) {
- pdfium_fuzzer_test("pdf_codec_tiff_fuzzer") {
- dict = "dicts/pdf_codec_tiff.dict"
- seed_corpus = "corpora/pdf_codec_tiff"
- }
- }
- pdfium_fuzzer_test("pdf_css_fuzzer") {
- dict = "dicts/pdf_css.dict"
- }
- pdfium_fuzzer_test("pdf_formcalc_context_fuzzer") {
- dict = "dicts/pdf_xfa_js.dict"
- }
- pdfium_fuzzer_test("pdf_formcalc_fuzzer") {
- dict = "dicts/pdf_formcalc.dict"
- }
- pdfium_fuzzer_test("pdf_formcalc_translate_fuzzer") {
- dict = "dicts/pdf_formcalc.dict"
- }
- if (pdf_enable_xfa_gif) {
- pdfium_fuzzer_test("pdf_lzw_fuzzer") {
- }
- }
- pdfium_fuzzer_test("pdf_bidi_fuzzer") {
- }
- pdfium_fuzzer_test("pdf_cfx_barcode_fuzzer") {
- }
- pdfium_fuzzer_test("pdf_cfgas_stringformatter_fuzzer") {
- }
- pdfium_fuzzer_test("pdfium_xfa_fuzzer") {
- 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 = [ "//base" ]
- public_deps = [ ":xfa_proto" ]
- }
- 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_impl",
- ]
- } else {
- 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) {
- pdfium_fuzzer_test("pdf_cpdf_tounicodemap_fuzzer") {
- }
- pdfium_fuzzer_test("pdf_nametree_fuzzer") {
- }
- if (pdf_enable_xfa) {
- pdfium_fuzzer_test("pdf_xfa_fdp_fuzzer") {
- }
- pdfium_fuzzer_test("pdf_xfa_raw_fuzzer") {
- dict = "dicts/pdf_xfa_raw_fuzzer.dict"
- }
- pdfium_fuzzer_test("pdf_xfa_xdp_fdp_fuzzer") {
- dict = "dicts/pdf_xfa_raw_fuzzer.dict"
- }
- }
- }
- proto_library("xfa_proto") {
- sources = [ "pdfium_xfa_lpm_fuzzer/xfa.proto" ]
- }
|