1# Copyright 2016 The PDFium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("../../pdfium.gni")
6
7config("libfuzzer_config") {
8  configs = [ "../..:pdfium_core_config" ]
9
10  defines = [
11    "PNG_PREFIX",
12    "PNG_USE_READ_MACROS",
13  ]
14  include_dirs = [ "../.." ]
15  if (pdf_enable_v8) {
16    defines += [ "PDF_ENABLE_V8" ]
17  }
18  if (pdf_enable_xfa) {
19    defines += [ "PDF_ENABLE_XFA" ]
20  }
21}
22
23group("libfuzzer") {
24}
25
26template("pdfium_fuzzer") {
27  source_set(target_name) {
28    sources = invoker.sources
29    deps = [
30      "../..:pdfium",
31    ]
32    testonly = true
33    configs -= [ "//build/config/compiler:chromium_code" ]
34    configs += [
35      "//build/config/compiler:no_chromium_code",
36      ":libfuzzer_config",
37    ]
38  }
39}
40
41if (pdf_enable_xfa) {
42  pdfium_fuzzer("pdf_cfx_saxreader_fuzzer") {
43    sources = [
44      "pdf_cfx_saxreader_fuzzer.cc",
45    ]
46  }
47
48  pdfium_fuzzer("pdf_codec_bmp_fuzzer") {
49    sources = [
50      "pdf_codec_bmp_fuzzer.cc",
51      "xfa_codec_fuzzer.h",
52    ]
53  }
54
55  pdfium_fuzzer("pdf_codec_gif_fuzzer") {
56    sources = [
57      "pdf_codec_gif_fuzzer.cc",
58      "xfa_codec_fuzzer.h",
59    ]
60  }
61
62  pdfium_fuzzer("pdf_codec_jpeg_fuzzer") {
63    sources = [
64      "pdf_codec_jpeg_fuzzer.cc",
65      "xfa_codec_fuzzer.h",
66    ]
67  }
68
69  pdfium_fuzzer("pdf_codec_png_fuzzer") {
70    sources = [
71      "pdf_codec_png_fuzzer.cc",
72      "xfa_codec_fuzzer.h",
73    ]
74  }
75
76  pdfium_fuzzer("pdf_codec_tiff_fuzzer") {
77    sources = [
78      "pdf_codec_tiff_fuzzer.cc",
79      "xfa_codec_fuzzer.h",
80    ]
81  }
82
83  pdfium_fuzzer("pdf_css_fuzzer") {
84    sources = [
85      "pdf_css_fuzzer.cc",
86    ]
87  }
88
89  pdfium_fuzzer("pdf_fm2js_fuzzer") {
90    sources = [
91      "pdf_fm2js_fuzzer.cc",
92    ]
93  }
94
95  pdfium_fuzzer("pdf_xml_fuzzer") {
96    sources = [
97      "pdf_xml_fuzzer.cc",
98    ]
99  }
100}
101
102pdfium_fuzzer("pdf_cmap_fuzzer") {
103  sources = [
104    "pdf_cmap_fuzzer.cc",
105  ]
106}
107
108pdfium_fuzzer("pdf_codec_a85_fuzzer") {
109  sources = [
110    "pdf_codec_a85_fuzzer.cc",
111  ]
112}
113
114pdfium_fuzzer("pdf_codec_fax_fuzzer") {
115  sources = [
116    "pdf_codec_fax_fuzzer.cc",
117  ]
118}
119
120pdfium_fuzzer("pdf_codec_icc_fuzzer") {
121  sources = [
122    "pdf_codec_icc_fuzzer.cc",
123  ]
124}
125
126pdfium_fuzzer("pdf_codec_jbig2_fuzzer") {
127  sources = [
128    "pdf_codec_jbig2_fuzzer.cc",
129  ]
130}
131
132pdfium_fuzzer("pdf_codec_rle_fuzzer") {
133  sources = [
134    "pdf_codec_rle_fuzzer.cc",
135  ]
136}
137
138pdfium_fuzzer("pdf_hint_table_fuzzer") {
139  sources = [
140    "pdf_hint_table_fuzzer.cc",
141  ]
142}
143
144pdfium_fuzzer("pdf_jpx_fuzzer") {
145  sources = [
146    "pdf_jpx_fuzzer.cc",
147  ]
148}
149
150pdfium_fuzzer("pdf_psengine_fuzzer") {
151  sources = [
152    "pdf_psengine_fuzzer.cc",
153  ]
154}
155
156pdfium_fuzzer("pdf_streamparser_fuzzer") {
157  sources = [
158    "pdf_streamparser_fuzzer.cc",
159  ]
160}
161