| OLD | NEW |
| 1 # Copyright 2016 The PDFium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("../../pdfium.gni") | 5 import("../../pdfium.gni") |
| 6 | 6 |
| 7 config("libfuzzer_config") { | 7 config("libfuzzer_config") { |
| 8 configs = [ "//third_party/pdfium:pdfium_core_config" ] | 8 configs = [ "../..:pdfium_core_config" ] |
| 9 | 9 |
| 10 defines = [ | 10 defines = [ |
| 11 "PNG_PREFIX", | 11 "PNG_PREFIX", |
| 12 "PNG_USE_READ_MACROS", | 12 "PNG_USE_READ_MACROS", |
| 13 ] | 13 ] |
| 14 include_dirs = [ "../.." ] | 14 include_dirs = [ "../.." ] |
| 15 if (pdf_enable_v8) { | 15 if (pdf_enable_v8) { |
| 16 defines += [ "PDF_ENABLE_V8" ] | 16 defines += [ "PDF_ENABLE_V8" ] |
| 17 } | 17 } |
| 18 if (pdf_enable_xfa) { | 18 if (pdf_enable_xfa) { |
| 19 defines += [ "PDF_ENABLE_XFA" ] | 19 defines += [ "PDF_ENABLE_XFA" ] |
| 20 } | 20 } |
| 21 } | 21 } |
| 22 | 22 |
| 23 if (pdf_enable_xfa) { | 23 group("libfuzzer") { |
| 24 source_set("pdf_fm2js_fuzzer") { | 24 } |
| 25 |
| 26 template("pdfium_fuzzer") { |
| 27 source_set(target_name) { |
| 28 sources = invoker.sources |
| 29 deps = [ |
| 30 "../..:pdfium", |
| 31 ] |
| 25 testonly = true | 32 testonly = true |
| 26 sources = [ | |
| 27 "pdf_fm2js_fuzzer.cc", | |
| 28 ] | |
| 29 deps = [ | |
| 30 "//third_party/pdfium:pdfium", | |
| 31 ] | |
| 32 configs -= [ "//build/config/compiler:chromium_code" ] | |
| 33 configs += [ | |
| 34 "//build/config/compiler:no_chromium_code", | |
| 35 ":libfuzzer_config", | |
| 36 ] | |
| 37 } | |
| 38 source_set("pdf_xml_fuzzer") { | |
| 39 testonly = true | |
| 40 sources = [ | |
| 41 "pdf_xml_fuzzer.cc", | |
| 42 ] | |
| 43 deps = [ | |
| 44 "//third_party/pdfium:pdfium", | |
| 45 ] | |
| 46 configs -= [ "//build/config/compiler:chromium_code" ] | |
| 47 configs += [ | |
| 48 "//build/config/compiler:no_chromium_code", | |
| 49 ":libfuzzer_config", | |
| 50 ] | |
| 51 } | |
| 52 source_set("pdf_cfx_saxreader_fuzzer") { | |
| 53 testonly = true | |
| 54 sources = [ | |
| 55 "pdf_cfx_saxreader_fuzzer.cc", | |
| 56 ] | |
| 57 deps = [ | |
| 58 "//third_party/pdfium:pdfium", | |
| 59 ] | |
| 60 configs -= [ "//build/config/compiler:chromium_code" ] | |
| 61 configs += [ | |
| 62 "//build/config/compiler:no_chromium_code", | |
| 63 ":libfuzzer_config", | |
| 64 ] | |
| 65 } | |
| 66 source_set("pdf_codec_png_fuzzer") { | |
| 67 testonly = true | |
| 68 sources = [ | |
| 69 "pdf_codec_png_fuzzer.cc", | |
| 70 "xfa_codec_fuzzer.h", | |
| 71 ] | |
| 72 deps = [ | |
| 73 "//third_party/pdfium:pdfium", | |
| 74 ] | |
| 75 configs -= [ "//build/config/compiler:chromium_code" ] | |
| 76 configs += [ | |
| 77 "//build/config/compiler:no_chromium_code", | |
| 78 ":libfuzzer_config", | |
| 79 ] | |
| 80 } | |
| 81 source_set("pdf_codec_jpeg_fuzzer") { | |
| 82 testonly = true | |
| 83 sources = [ | |
| 84 "pdf_codec_jpeg_fuzzer.cc", | |
| 85 "xfa_codec_fuzzer.h", | |
| 86 ] | |
| 87 deps = [ | |
| 88 "//third_party/pdfium:pdfium", | |
| 89 ] | |
| 90 configs -= [ "//build/config/compiler:chromium_code" ] | |
| 91 configs += [ | |
| 92 "//build/config/compiler:no_chromium_code", | |
| 93 ":libfuzzer_config", | |
| 94 ] | |
| 95 } | |
| 96 source_set("pdf_codec_gif_fuzzer") { | |
| 97 testonly = true | |
| 98 sources = [ | |
| 99 "pdf_codec_gif_fuzzer.cc", | |
| 100 "xfa_codec_fuzzer.h", | |
| 101 ] | |
| 102 deps = [ | |
| 103 "//third_party/pdfium:pdfium", | |
| 104 ] | |
| 105 configs -= [ "//build/config/compiler:chromium_code" ] | |
| 106 configs += [ | |
| 107 "//build/config/compiler:no_chromium_code", | |
| 108 ":libfuzzer_config", | |
| 109 ] | |
| 110 } | |
| 111 source_set("pdf_codec_bmp_fuzzer") { | |
| 112 testonly = true | |
| 113 sources = [ | |
| 114 "pdf_codec_bmp_fuzzer.cc", | |
| 115 "xfa_codec_fuzzer.h", | |
| 116 ] | |
| 117 deps = [ | |
| 118 "//third_party/pdfium:pdfium", | |
| 119 ] | |
| 120 configs -= [ "//build/config/compiler:chromium_code" ] | |
| 121 configs += [ | |
| 122 "//build/config/compiler:no_chromium_code", | |
| 123 ":libfuzzer_config", | |
| 124 ] | |
| 125 } | |
| 126 source_set("pdf_codec_tiff_fuzzer") { | |
| 127 testonly = true | |
| 128 sources = [ | |
| 129 "pdf_codec_tiff_fuzzer.cc", | |
| 130 "xfa_codec_fuzzer.h", | |
| 131 ] | |
| 132 deps = [ | |
| 133 "//third_party/pdfium:pdfium", | |
| 134 ] | |
| 135 configs -= [ "//build/config/compiler:chromium_code" ] | |
| 136 configs += [ | |
| 137 "//build/config/compiler:no_chromium_code", | |
| 138 ":libfuzzer_config", | |
| 139 ] | |
| 140 } | |
| 141 source_set("pdf_css_fuzzer") { | |
| 142 testonly = true | |
| 143 sources = [ | |
| 144 "pdf_css_fuzzer.cc", | |
| 145 ] | |
| 146 deps = [ | |
| 147 "//third_party/pdfium:pdfium", | |
| 148 ] | |
| 149 configs -= [ "//build/config/compiler:chromium_code" ] | 33 configs -= [ "//build/config/compiler:chromium_code" ] |
| 150 configs += [ | 34 configs += [ |
| 151 "//build/config/compiler:no_chromium_code", | 35 "//build/config/compiler:no_chromium_code", |
| 152 ":libfuzzer_config", | 36 ":libfuzzer_config", |
| 153 ] | 37 ] |
| 154 } | 38 } |
| 155 } | 39 } |
| 156 | 40 |
| 157 source_set("pdf_cmap_fuzzer") { | 41 if (pdf_enable_xfa) { |
| 158 testonly = true | 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 |
| 102 pdfium_fuzzer("pdf_cmap_fuzzer") { |
| 159 sources = [ | 103 sources = [ |
| 160 "pdf_cmap_fuzzer.cc", | 104 "pdf_cmap_fuzzer.cc", |
| 161 ] | 105 ] |
| 162 deps = [ | 106 } |
| 163 "//third_party/pdfium:pdfium", | 107 |
| 164 ] | 108 pdfium_fuzzer("pdf_codec_fax_fuzzer") { |
| 165 configs -= [ "//build/config/compiler:chromium_code" ] | 109 sources = [ |
| 166 configs += [ | 110 "pdf_codec_fax_fuzzer.cc", |
| 167 "//build/config/compiler:no_chromium_code", | |
| 168 ":libfuzzer_config", | |
| 169 ] | 111 ] |
| 170 } | 112 } |
| 171 | 113 |
| 172 source_set("pdf_codec_fax_fuzzer") { | 114 pdfium_fuzzer("pdf_codec_icc_fuzzer") { |
| 173 testonly = true | |
| 174 sources = [ | 115 sources = [ |
| 175 "pdf_codec_fax_fuzzer.cc", | 116 "pdf_codec_icc_fuzzer.cc", |
| 176 ] | |
| 177 deps = [ | |
| 178 "//third_party/pdfium:pdfium", | |
| 179 ] | |
| 180 configs -= [ "//build/config/compiler:chromium_code" ] | |
| 181 configs += [ | |
| 182 "//build/config/compiler:no_chromium_code", | |
| 183 ":libfuzzer_config", | |
| 184 ] | 117 ] |
| 185 } | 118 } |
| 186 | 119 |
| 187 source_set("pdf_codec_icc_fuzzer") { | 120 pdfium_fuzzer("pdf_codec_jbig2_fuzzer") { |
| 188 testonly = true | |
| 189 sources = [ | 121 sources = [ |
| 190 "pdf_codec_icc_fuzzer.cc", | 122 "pdf_codec_jbig2_fuzzer.cc", |
| 191 ] | |
| 192 deps = [ | |
| 193 "//third_party/pdfium:pdfium", | |
| 194 ] | |
| 195 configs -= [ "//build/config/compiler:chromium_code" ] | |
| 196 configs += [ | |
| 197 "//build/config/compiler:no_chromium_code", | |
| 198 ":libfuzzer_config", | |
| 199 ] | 123 ] |
| 200 } | 124 } |
| 201 | 125 |
| 202 source_set("pdf_codec_jbig2_fuzzer") { | 126 pdfium_fuzzer("pdf_hint_table_fuzzer") { |
| 203 testonly = true | |
| 204 sources = [ | 127 sources = [ |
| 205 "pdf_codec_jbig2_fuzzer.cc", | 128 "pdf_hint_table_fuzzer.cc", |
| 206 ] | |
| 207 deps = [ | |
| 208 "//third_party/pdfium:pdfium", | |
| 209 ] | |
| 210 configs -= [ "//build/config/compiler:chromium_code" ] | |
| 211 configs += [ | |
| 212 "//build/config/compiler:no_chromium_code", | |
| 213 ":libfuzzer_config", | |
| 214 ] | 129 ] |
| 215 } | 130 } |
| 216 | 131 |
| 217 source_set("pdf_jpx_fuzzer") { | 132 pdfium_fuzzer("pdf_jpx_fuzzer") { |
| 218 testonly = true | |
| 219 sources = [ | 133 sources = [ |
| 220 "pdf_jpx_fuzzer.cc", | 134 "pdf_jpx_fuzzer.cc", |
| 221 ] | 135 ] |
| 222 deps = [ | 136 } |
| 223 "//third_party/pdfium:pdfium", | 137 |
| 224 ] | 138 pdfium_fuzzer("pdf_psengine_fuzzer") { |
| 225 configs -= [ "//build/config/compiler:chromium_code" ] | 139 sources = [ |
| 226 configs += [ | 140 "pdf_psengine_fuzzer.cc", |
| 227 "//build/config/compiler:no_chromium_code", | |
| 228 ":libfuzzer_config", | |
| 229 ] | 141 ] |
| 230 } | 142 } |
| 231 | 143 |
| 232 source_set("pdf_psengine_fuzzer") { | 144 pdfium_fuzzer("pdf_streamparser_fuzzer") { |
| 233 testonly = true | |
| 234 sources = [ | |
| 235 "pdf_psengine_fuzzer.cc", | |
| 236 ] | |
| 237 deps = [ | |
| 238 "//third_party/pdfium:pdfium", | |
| 239 ] | |
| 240 configs -= [ "//build/config/compiler:chromium_code" ] | |
| 241 configs += [ | |
| 242 "//build/config/compiler:no_chromium_code", | |
| 243 ":libfuzzer_config", | |
| 244 ] | |
| 245 } | |
| 246 | |
| 247 source_set("pdf_hint_table_fuzzer") { | |
| 248 testonly = true | |
| 249 sources = [ | |
| 250 "pdf_hint_table_fuzzer.cc", | |
| 251 ] | |
| 252 deps = [ | |
| 253 "//third_party/pdfium:pdfium", | |
| 254 ] | |
| 255 configs -= [ "//build/config/compiler:chromium_code" ] | |
| 256 configs += [ | |
| 257 "//build/config/compiler:no_chromium_code", | |
| 258 ":libfuzzer_config", | |
| 259 ] | |
| 260 } | |
| 261 | |
| 262 source_set("pdf_streamparser_fuzzer") { | |
| 263 testonly = true | |
| 264 sources = [ | 145 sources = [ |
| 265 "pdf_streamparser_fuzzer.cc", | 146 "pdf_streamparser_fuzzer.cc", |
| 266 ] | 147 ] |
| 267 deps = [ | |
| 268 "//third_party/pdfium:pdfium", | |
| 269 ] | |
| 270 configs -= [ "//build/config/compiler:chromium_code" ] | |
| 271 configs += [ | |
| 272 "//build/config/compiler:no_chromium_code", | |
| 273 ":libfuzzer_config", | |
| 274 ] | |
| 275 } | 148 } |
| OLD | NEW |