1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522
|
# Copyright 2015 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Individual libfuzzer tests that didn't find their home yet.
import("//build/config/features.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//third_party/protobuf/proto_library.gni")
import("//v8/gni/v8.gni")
# root BUILD depends on this target. Needed for package discovery
group("fuzzers") {
}
fuzzer_test("empty_fuzzer") {
sources = [ "empty_fuzzer.cc" ]
additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ]
}
fuzzer_test("string_compare_fuzzer") {
sources = [ "string_compare_fuzzer.cc" ]
additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ]
}
fuzzer_test("string_compare_proto_fuzzer") {
sources = [ "string_compare_proto_fuzzer.cc" ]
deps = [
"//testing/libfuzzer/proto:string_compare_proto",
"//third_party/libprotobuf-mutator",
]
additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ]
}
fuzzer_test("snappy_compress_fuzzer") {
sources = [ "snappy_compress_fuzzer.cc" ]
deps = [ "//third_party/snappy:snappy" ]
seed_corpus = "//third_party/snappy/src/testdata"
}
fuzzer_test("snappy_uncompress_fuzzer") {
sources = [ "snappy_uncompress_fuzzer.cc" ]
deps = [ "//third_party/snappy:snappy" ]
seed_corpus = "//third_party/snappy/src/testdata"
}
fuzzer_test("template_url_parser_fuzzer") {
sources = [ "template_url_parser_fuzzer.cc" ]
deps = [
"//base",
"//base:i18n",
"//components/search_engines",
"//mojo/core/embedder",
"//services/data_decoder/public/cpp",
"//services/data_decoder/public/cpp:test_support",
"//third_party/libxml:libxml",
]
dict = "//third_party/libxml/fuzz/xml.dict"
libfuzzer_options = [ "max_len=4096" ]
}
fuzzer_test("url_parse_proto_fuzzer") {
sources = [ "url_parse_proto_fuzzer.cc" ]
deps = [
"//base",
"//base:i18n",
"//testing/libfuzzer/proto:url_proto",
"//third_party/libprotobuf-mutator",
"//url:url",
]
}
fuzzer_test("libsrtp_fuzzer") {
sources = [ "libsrtp_fuzzer.cc" ]
deps = [ "//third_party/libsrtp" ]
libfuzzer_options = [ "max_len=1500" ]
}
libpng_seed_corpuses = [
"//components/test/data/viz",
"//third_party/blink/web_tests/images/png-suite/samples",
"//third_party/blink/web_tests/images/resources/pngfuzz",
]
fuzzer_test("gfx_png_image_fuzzer") {
sources = [ "gfx_png_image_fuzzer.cc" ]
deps = [
"//base",
"//ui/base",
"//ui/gfx",
]
dict = "dicts/png.dict"
seed_corpuses = libpng_seed_corpuses
}
fuzzer_test("libxml_xml_read_memory_fuzzer") {
sources = [ "libxml_xml_read_memory_fuzzer.cc" ]
deps = [ "//third_party/libxml:libxml" ]
dict = "//third_party/libxml/fuzz/xml.dict"
seed_corpus = "//third_party/libxml/fuzz/seed_corpus"
}
fuzzer_test("libpng_progressive_read_fuzzer") {
sources = [ "libpng_read_fuzzer.cc" ]
deps = [
"//base",
"//third_party/libpng",
]
dict = "dicts/png.dict"
seed_corpuses = libpng_seed_corpuses
}
template("v8_fuzzer") {
if (defined(invoker.v8_dep)) {
_deps = [ "//v8:${invoker.v8_dep}" ]
} else {
_deps = [ "//v8:${target_name}" ]
}
fuzzer_test("v8_${target_name}") {
forward_variables_from(invoker,
"*",
[
"v8_dep",
"max_len",
])
sources = []
deps = _deps
if (defined(invoker.max_len)) {
if (!defined(libfuzzer_options)) {
libfuzzer_options = []
}
libfuzzer_options += [ "max_len=${invoker.max_len}" ]
}
asan_options = [
"allow_user_segv_handler=1",
"handle_sigtrap=1",
]
msan_options = [ "handle_sigtrap=1" ]
ubsan_options = [
"handle_sigtrap=1",
"handle_segv=1",
]
environment_variables = [ "AFL_DRIVER_DONT_DEFER=1" ]
}
}
v8_fuzzer("script_parser_fuzzer") {
v8_dep = "parser_fuzzer"
dict = "dicts/generated/javascript.dict"
seed_corpus = "//v8/test/mjsunit/regress/"
libfuzzer_options = [ "only_ascii=1" ]
}
v8_inspector_fuzzer_corpus_dir = "$target_gen_dir/v8_inspector_fuzzer_corpus"
action("generate_v8_inspector_fuzzer_corpus") {
script = "generate_v8_inspector_fuzzer_corpus.py"
sources = [ "generate_v8_inspector_fuzzer_corpus.py" ]
args = [
rebase_path("//v8/test/inspector/", root_build_dir),
rebase_path(v8_inspector_fuzzer_corpus_dir, root_build_dir),
]
outputs = [ v8_inspector_fuzzer_corpus_dir ]
}
v8_fuzzer("inspector_fuzzer") {
dict = "dicts/generated/javascript.dict"
seed_corpus = v8_inspector_fuzzer_corpus_dir
seed_corpus_deps = [ ":generate_v8_inspector_fuzzer_corpus" ]
# The fuzzer is able to handle any input, but since the input is interpreted
# as JS code, restricting to ascii only will increase fuzzing efficiency.
libfuzzer_options = [ "only_ascii=1" ]
}
v8_fuzzer("json_parser_fuzzer") {
v8_dep = "json_fuzzer"
dict = "dicts/json.dict"
}
v8_fuzzer("regexp_parser_fuzzer") {
v8_dep = "regexp_fuzzer"
dict = "dicts/regexp.dict"
seed_corpus = "//v8/test/fuzzer/regexp/"
libfuzzer_options = [ "max_len=64" ]
}
if (v8_enable_webassembly) {
v8_fuzzer("multi_return_fuzzer") {
# TODO(https://crbug.com/394563978): Remove once experiment ends.
high_end_job_required = true
high_end_debug_job_required = true
}
v8_fuzzer("wasm_code_fuzzer") {
max_len = 500
# TODO(https://crbug.com/394563978): Remove once experiment ends.
high_end_job_required = true
high_end_debug_job_required = true
}
v8_fuzzer("wasm_module_fuzzer") {
max_len = 500
seed_corpus = "//testing/libfuzzer/fuzzers/wasm_corpus/"
# TODO(https://crbug.com/394563978): Remove once experiment ends.
high_end_job_required = true
high_end_debug_job_required = true
}
v8_fuzzer("wasm_async_fuzzer") {
max_len = 500
seed_corpus = "//testing/libfuzzer/fuzzers/wasm_corpus/"
# TODO(https://crbug.com/394563978): Remove once experiment ends.
high_end_job_required = true
high_end_debug_job_required = true
}
v8_fuzzer("wasm_streaming_fuzzer") {
max_len = 500
seed_corpus = "//testing/libfuzzer/fuzzers/wasm_corpus/"
# TODO(https://crbug.com/394563978): Remove once experiment ends.
high_end_job_required = true
high_end_debug_job_required = true
}
# These fuzzers are not supported in official builds as they depend on
# functionality in the v8 library that is skipped in official builds for
# binary size reasons.
if (!is_official_build) {
v8_fuzzer("wasm_compile_all_fuzzer") {
max_len = 500
# TODO(https://crbug.com/394563978): Remove once experiment ends.
high_end_job_required = true
high_end_debug_job_required = true
}
v8_fuzzer("wasm_compile_fuzzer") {
max_len = 500
# TODO(https://crbug.com/394563978): Remove once experiment ends.
high_end_job_required = true
high_end_debug_job_required = true
}
v8_fuzzer("wasm_compile_simd_fuzzer") {
max_len = 500
# TODO(https://crbug.com/394563978): Remove once experiment ends.
high_end_job_required = true
high_end_debug_job_required = true
}
v8_fuzzer("wasm_compile_wasmgc_fuzzer") {
max_len = 500
# TODO(https://crbug.com/394563978): Remove once experiment ends.
high_end_job_required = true
high_end_debug_job_required = true
}
v8_fuzzer("wasm_compile_revec_fuzzer") {
max_len = 500
# TODO(https://crbug.com/394563978): Remove once experiment ends.
high_end_job_required = true
high_end_debug_job_required = true
}
v8_fuzzer("wasm_init_expr_fuzzer") {
max_len = 500
# TODO(https://crbug.com/394563978): Remove once experiment ends.
high_end_job_required = true
high_end_debug_job_required = true
}
v8_fuzzer("wasm_deopt_fuzzer") {
max_len = 500
# TODO(https://crbug.com/394563978): Remove once experiment ends.
high_end_job_required = true
high_end_debug_job_required = true
}
}
}
fuzzer_test("convert_woff2ttf_fuzzer") {
sources = [ "convert_woff2ttf_fuzzer.cc" ]
deps = [ "//third_party/woff2:woff2_dec" ]
seed_corpus = "//testing/libfuzzer/fuzzers/woff2_corpus"
libfuzzer_options = [ "max_len=803500" ]
}
fuzzer_test("flatbuffers_verifier_fuzzer") {
sources = [ "flatbuffers_verifier_fuzzer.cc" ]
deps = [
"//third_party/flatbuffers",
"//third_party/flatbuffers:flatbuffers_samplebuffer",
]
libfuzzer_options = [ "max_len=1024" ]
seed_corpus = "//testing/libfuzzer/fuzzers/flatbuffers_corpus"
}
fuzzer_test("skia_path_fuzzer") {
sources = [
"skia_path_common.cc",
"skia_path_common.h",
"skia_path_fuzzer.cc",
]
deps = [
"//base",
"//skia",
]
libfuzzer_options = [ "max_len=256" ]
if (is_debug) {
# Disabled due to crashing on SkASSERT (crbug.com/642750, crbug.com/643275).
additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ]
}
}
fuzzer_test("skia_pathop_fuzzer") {
sources = [
"skia_path_common.cc",
"skia_path_common.h",
"skia_pathop_fuzzer.cc",
]
deps = [
"//base",
"//skia",
]
libfuzzer_options = [ "max_len=512" ]
if (is_debug) {
# Disabled due to crashing on SkASSERT (crbug.com/642750, crbug.com/643275).
additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ]
}
}
fuzzer_test("prtime_fuzzer") {
sources = [ "prtime_fuzzer.cc" ]
deps = [ "//base" ]
dict = "dicts/prtime.dict"
libfuzzer_options = [ "max_len=1024" ]
}
fuzzer_test("angle_translator_fuzzer") {
sources = []
deps = [ "//third_party/angle:translator_fuzzer" ]
libfuzzer_options = [ "max_len=1000" ]
dict = "dicts/webgl-glsl.dict"
}
fuzzer_test("sha1_fuzzer") {
sources = [ "sha1_fuzzer.cc" ]
deps = [ "//base" ]
}
fuzzer_test("hash_fuzzer") {
sources = [ "hash_fuzzer.cc" ]
deps = [ "//base" ]
}
action("gen_javascript_parser_proto") {
# Only targets in this file and the top-level visibility target can
# depend on this.
visibility = [ ":*" ]
script = "generate_javascript_parser_proto.py"
sources = [ "dicts/javascript_parser_proto.dict" ]
outputs = [
"$target_gen_dir/javascript_parser.proto",
"$target_gen_dir/javascript_parser_proto_to_string.cc",
]
args = rebase_path(outputs, root_build_dir) +
rebase_path(sources, root_build_dir)
}
proto_library("javascript_parser_proto") {
sources = [ "$target_gen_dir/javascript_parser.proto" ]
proto_deps = [ ":gen_javascript_parser_proto" ]
proto_out_dir = ""
}
fuzzer_test("javascript_parser_proto_fuzzer") {
generated_sources = [ "$target_gen_dir/javascript_parser_proto_to_string.cc" ]
sources = [
"javascript_parser_proto_fuzzer.cc",
"javascript_parser_proto_to_string.h",
]
deps = [
":gen_javascript_parser_proto",
":javascript_parser_proto",
"//base",
"//third_party/libprotobuf-mutator",
"//v8:v8",
"//v8:v8_libplatform",
]
}
fuzzer_test("v8_fully_instrumented_fuzzer") {
sources = [ "v8_fuzzer.cc" ]
deps = [
"//base",
"//v8:v8",
"//v8:v8_libplatform",
]
dict = "dicts/generated/javascript.dict"
asan_options = [
"allow_user_segv_handler=1",
"handle_sigtrap=1",
]
msan_options = [ "handle_sigtrap=1" ]
ubsan_options = [
"handle_sigtrap=1",
"handle_segv=1",
]
libfuzzer_options = [ "only_ascii=1" ]
}
fuzzer_test("skia_image_filter_proto_fuzzer") {
sources = [ "skia_image_filter_proto_fuzzer.cc" ]
deps = [
"//base",
"//base/test:test_support",
"//skia",
"//testing/libfuzzer/proto:skia_image_filter_converter",
"//testing/libfuzzer/proto:skia_image_filter_proto",
"//third_party/libprotobuf-mutator",
]
}
# We build the libyuv_scale_fuzzer both for fuzztest
# and libfuzzer, for education/comparison purposes.
# Abstract the common parts:
source_set("libyuv_scale_fuzzer_common") {
testonly = true
sources = [
"libyuv_scale_fuzzer.cc",
"libyuv_scale_fuzzer.h",
]
public_deps = [ "//third_party/libyuv" ]
}
# The libfuzzer version (which also works with other compatible
# frameworks, e.g. centipede)
fuzzer_test("libyuv_scale_fuzzer") {
sources = [ "libyuv_scale_fuzzer_libfuzzer.cc" ]
deps = [ ":libyuv_scale_fuzzer_common" ]
}
# This is a fuzztest fuzzer, which (for now) means we build this as
# a unit test rather than using a fuzzing gn template such as
# fuzzer_test.
# This executable can be run in four modes:
# modes:
# ./libyuv_scale_fuzzer - runs a small amount of fuzzing as if
# to fit in with a unit test framework, just to look for
# egregious bugs
# With the enable_fuzztest_fuzz gn arg:
# ./libyuv_scale_fuzzer -fuzz= - fuzzes properly.
# With the use_centipede gn arg:
# centipede --binary=libyuv_scale_fuzzer - fuzzes using centipede
# With the use_libfuzzer gn arg:
# ./libyuv_scale_fuzzer - runs in a libfuzzer-compatible way
# Note that right now this is using the plain 'test' template.
# In time, we may choose a different option here.
test("libyuv_scale_fuzztest") {
sources = [ "libyuv_scale_fuzztest.cc" ]
fuzztests = [ "ScaleFuzz.ScaleDoesNotCrash" ]
deps = [
":libyuv_scale_fuzzer_common",
"//third_party/fuzztest:fuzztest_gtest_main",
]
}
test("paint_vector_icon_fuzztest") {
sources = [ "paint_vector_icon_fuzztest.cc" ]
fuzztests = [ "PaintVectorIconFuzzTest.PaintVectorIcon" ]
deps = [
"//base",
"//skia:skia_switches",
"//third_party/fuzztest:fuzztest_gtest_main",
"//ui/gfx:gfx",
]
}
# Figure why this fuzzer constantly misbehaves on libfuzzer builds.
# See crbug.com/406454922.
if (use_centipede) {
test("chrome_tint_wgsl_fuzzer") {
sources = [
"tint_wgsl_fuzzer.cc",
"tint_wgsl_fuzzer_grammar.h",
]
fuzztests = [
"ChromiumTintWgslTest.CanParseProgramWithoutCrashing",
"ChromiumTintWgslTest.CanConvertWgslToIRWithoutCrashing",
]
fuzztest_additional_args = [ "--stack_limit_kb=512" ]
deps = [
"//base",
"//third_party/dawn/src/tint/cmd/fuzz/wgsl:fuzz",
"//third_party/dawn/src/tint/lang/wgsl/reader:reader",
"//third_party/fuzztest:fuzztest_gtest_main",
]
}
}
|