diff options
Diffstat (limited to 'third_party/libwebrtc/test/fuzzers/BUILD.gn')
-rw-r--r-- | third_party/libwebrtc/test/fuzzers/BUILD.gn | 691 |
1 files changed, 691 insertions, 0 deletions
diff --git a/third_party/libwebrtc/test/fuzzers/BUILD.gn b/third_party/libwebrtc/test/fuzzers/BUILD.gn new file mode 100644 index 0000000000..3d2ac7a7e7 --- /dev/null +++ b/third_party/libwebrtc/test/fuzzers/BUILD.gn @@ -0,0 +1,691 @@ +# Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. +# +# Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file in the root of the source +# tree. An additional intellectual property rights grant can be found +# in the file PATENTS. All contributing project authors may +# be found in the AUTHORS file in the root of the source tree. + +import("//build/config/features.gni") +import("//testing/libfuzzer/fuzzer_test.gni") +import("../../webrtc.gni") + +rtc_library("webrtc_fuzzer_main") { + sources = [ "webrtc_fuzzer_main.cc" ] + deps = [ + "../../rtc_base:logging", + "//testing/libfuzzer:fuzzing_engine_main", + ] + + # When WebRTC fuzzer tests are built on Chromium bots they need to link + # with Chromium's implementation of metrics, field trial, and system time. + if (build_with_chromium) { + deps += [ + "../../../webrtc_overrides:field_trial", + "../../../webrtc_overrides:metrics", + "../../../webrtc_overrides:system_time", + ] + } +} + +rtc_library("fuzz_data_helper") { + testonly = true + sources = [ + "fuzz_data_helper.cc", + "fuzz_data_helper.h", + ] + deps = [ + "../../api:array_view", + "../../modules/rtp_rtcp:rtp_rtcp_format", + ] + visibility = [ ":*" ] # Only targets in this file can depend on this. +} + +set_defaults("webrtc_fuzzer_test") { + configs = rtc_add_configs + absl_deps = [] +} + +template("webrtc_fuzzer_test") { + fuzzer_test(target_name) { + forward_variables_from(invoker, "*") + deps += [ + ":fuzz_data_helper", + ":webrtc_fuzzer_main", + ] + additional_configs = configs + + # If absl_deps is [], no action is needed. If not [], then it needs to be + # converted to //third_party/abseil-cpp:absl when build_with_chromium=true + # otherwise it just needs to be added to deps. + if (absl_deps != []) { + if (!defined(deps)) { + deps = [] + } + if (build_with_chromium) { + deps += [ "//third_party/abseil-cpp:absl" ] + } else { + deps += absl_deps + } + } + + if (!build_with_chromium && is_clang) { + suppressed_configs = [ "//build/config/clang:find_bad_constructs" ] + } + } +} + +webrtc_fuzzer_test("h264_depacketizer_fuzzer") { + sources = [ "h264_depacketizer_fuzzer.cc" ] + deps = [ "../../modules/rtp_rtcp" ] + seed_corpus = "corpora/h264-depacketizer-fuzzer-corpus" +} + +webrtc_fuzzer_test("vp8_depacketizer_fuzzer") { + sources = [ "vp8_depacketizer_fuzzer.cc" ] + deps = [ + "../../api:array_view", + "../../modules/rtp_rtcp", + "../../modules/rtp_rtcp:rtp_video_header", + ] +} + +webrtc_fuzzer_test("vp9_depacketizer_fuzzer") { + sources = [ "vp9_depacketizer_fuzzer.cc" ] + deps = [ + "../../api:array_view", + "../../modules/rtp_rtcp", + "../../modules/rtp_rtcp:rtp_video_header", + ] +} + +webrtc_fuzzer_test("vp8_qp_parser_fuzzer") { + sources = [ "vp8_qp_parser_fuzzer.cc" ] + deps = [ + "../../modules/video_coding:video_coding_utility", + "../../modules/video_coding/", + ] +} + +webrtc_fuzzer_test("vp9_qp_parser_fuzzer") { + sources = [ "vp9_qp_parser_fuzzer.cc" ] + deps = [ + "../../modules/video_coding:video_coding_utility", + "../../modules/video_coding/", + ] +} + +webrtc_fuzzer_test("h264_bitstream_parser_fuzzer") { + sources = [ "h264_bitstream_parser_fuzzer.cc" ] + deps = [ + "../../common_video", + "../../modules/video_coding/", + ] +} + +if (rtc_use_h265) { + webrtc_fuzzer_test("h265_bitstream_parser_fuzzer") { + sources = [ "h265_bitstream_parser_fuzzer.cc" ] + deps = [ + "../../common_video", + "../../modules/video_coding/", + ] + } +} + +webrtc_fuzzer_test("forward_error_correction_fuzzer") { + sources = [ "forward_error_correction_fuzzer.cc" ] + deps = [ + "../../api:scoped_refptr", + "../../modules/rtp_rtcp", + "../../modules/rtp_rtcp:rtp_rtcp_format", + "../../rtc_base:byte_buffer", + ] +} + +webrtc_fuzzer_test("flexfec_header_reader_fuzzer") { + sources = [ "flexfec_header_reader_fuzzer.cc" ] + deps = [ + "../../api:scoped_refptr", + "../../modules/rtp_rtcp", + "../../modules/rtp_rtcp:rtp_rtcp_format", + ] +} + +webrtc_fuzzer_test("flexfec_sender_fuzzer") { + sources = [ "flexfec_sender_fuzzer.cc" ] + deps = [ + "../../modules/rtp_rtcp", + "../../modules/rtp_rtcp:rtp_rtcp_format", + "../../system_wrappers", + ] +} + +webrtc_fuzzer_test("ulpfec_header_reader_fuzzer") { + sources = [ "ulpfec_header_reader_fuzzer.cc" ] + deps = [ + "../../api:scoped_refptr", + "../../modules/rtp_rtcp", + "../../modules/rtp_rtcp:fec_test_helper", + "../../modules/rtp_rtcp:rtp_rtcp_format", + ] +} + +webrtc_fuzzer_test("ulpfec_generator_fuzzer") { + sources = [ "ulpfec_generator_fuzzer.cc" ] + deps = [ + "../../modules:module_api_public", + "../../modules/rtp_rtcp", + "../../modules/rtp_rtcp:fec_test_helper", + "../../modules/rtp_rtcp:rtp_rtcp_format", + "../../rtc_base:checks", + "../../rtc_base:copy_on_write_buffer", + "../../system_wrappers", + ] +} + +webrtc_fuzzer_test("ulpfec_receiver_fuzzer") { + sources = [ "ulpfec_receiver_fuzzer.cc" ] + deps = [ + ":fuzz_data_helper", + "../../modules/rtp_rtcp", + "../../modules/rtp_rtcp:rtp_rtcp_format", + ] +} + +webrtc_fuzzer_test("flexfec_receiver_fuzzer") { + sources = [ "flexfec_receiver_fuzzer.cc" ] + deps = [ + "../../modules/rtp_rtcp", + "../../modules/rtp_rtcp:rtp_rtcp_format", + ] +} + +webrtc_fuzzer_test("rtp_video_frame_assembler_fuzzer") { + sources = [ "rtp_video_frame_assembler_fuzzer.cc" ] + deps = [ + "../../api/video:rtp_video_frame_assembler", + "../../modules/rtp_rtcp:rtp_rtcp_format", + ] +} + +webrtc_fuzzer_test("rtcp_receiver_fuzzer") { + sources = [ "rtcp_receiver_fuzzer.cc" ] + deps = [ + "../../modules/rtp_rtcp", + "../../modules/rtp_rtcp:rtp_rtcp_format", + "../../rtc_base:checks", + "../../system_wrappers", + ] + seed_corpus = "corpora/rtcp-corpus" +} + +webrtc_fuzzer_test("rtp_packet_fuzzer") { + sources = [ "rtp_packet_fuzzer.cc" ] + deps = [ "../../modules/rtp_rtcp:rtp_rtcp_format" ] + absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] + seed_corpus = "corpora/rtp-corpus" +} + +webrtc_fuzzer_test("rtp_packetizer_av1_fuzzer") { + sources = [ "rtp_packetizer_av1_fuzzer.cc" ] + deps = [ + "../../api/video:video_frame_type", + "../../modules/rtp_rtcp:rtp_rtcp", + "../../modules/rtp_rtcp:rtp_rtcp_format", + "../../rtc_base:checks", + ] +} + +webrtc_fuzzer_test("receive_side_congestion_controller_fuzzer") { + sources = [ "receive_side_congestion_controller_fuzzer.cc" ] + deps = [ + "../../api:array_view", + "../../api/units:time_delta", + "../../api/units:timestamp", + "../../modules/congestion_controller", + "../../modules/rtp_rtcp:rtp_rtcp_format", + "../../system_wrappers", + ] +} + +rtc_library("audio_decoder_fuzzer") { + testonly = true + sources = [ + "audio_decoder_fuzzer.cc", + "audio_decoder_fuzzer.h", + ] + deps = [ + "../../api/audio_codecs:audio_codecs_api", + "../../modules/rtp_rtcp:rtp_rtcp_format", + "../../rtc_base:checks", + ] + absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] +} + +webrtc_fuzzer_test("audio_decoder_g722_fuzzer") { + sources = [ "audio_decoder_g722_fuzzer.cc" ] + deps = [ + ":audio_decoder_fuzzer", + "../../modules/audio_coding:g722", + ] +} + +webrtc_fuzzer_test("audio_decoder_ilbc_fuzzer") { + sources = [ "audio_decoder_ilbc_fuzzer.cc" ] + deps = [ + ":audio_decoder_fuzzer", + "../../modules/audio_coding:ilbc", + ] +} + +webrtc_fuzzer_test("audio_decoder_opus_fuzzer") { + sources = [ "audio_decoder_opus_fuzzer.cc" ] + deps = [ + ":audio_decoder_fuzzer", + "../../modules/audio_coding:webrtc_opus", + ] +} + +webrtc_fuzzer_test("audio_decoder_opus_redundant_fuzzer") { + sources = [ "audio_decoder_opus_redundant_fuzzer.cc" ] + deps = [ + ":audio_decoder_fuzzer", + "../../modules/audio_coding:webrtc_opus", + ] +} + +webrtc_fuzzer_test("audio_decoder_multiopus_fuzzer") { + sources = [ "audio_decoder_multistream_opus_fuzzer.cc" ] + deps = [ + ":audio_decoder_fuzzer", + "../../api/audio_codecs/opus:audio_decoder_multiopus", + "../../api/audio_codecs/opus:audio_decoder_opus_config", + ] +} + +webrtc_fuzzer_test("audio_decoder_pcm_fuzzer") { + sources = [ "audio_decoder_pcm_fuzzer.cc" ] + deps = [ + ":audio_decoder_fuzzer", + "../../modules/audio_coding:g711", + ] +} + +webrtc_fuzzer_test("audio_decoder_pcm16b_fuzzer") { + sources = [ "audio_decoder_pcm16b_fuzzer.cc" ] + deps = [ + ":audio_decoder_fuzzer", + "../../modules/audio_coding:pcm16b", + ] +} + +rtc_library("audio_encoder_fuzzer") { + testonly = true + sources = [ + "audio_encoder_fuzzer.cc", + "audio_encoder_fuzzer.h", + ] + deps = [ + ":fuzz_data_helper", + "../../api:array_view", + "../../api/audio_codecs:audio_codecs_api", + "../../rtc_base:buffer", + "../../rtc_base:checks", + ] +} + +webrtc_fuzzer_test("audio_encoder_opus_fuzzer") { + sources = [ "audio_encoder_opus_fuzzer.cc" ] + deps = [ + ":audio_encoder_fuzzer", + "../../api/audio_codecs/opus:audio_encoder_opus", + "../../rtc_base:checks", + ] +} + +webrtc_fuzzer_test("turn_unwrap_fuzzer") { + sources = [ "turn_unwrap_fuzzer.cc" ] + deps = [ + "../../media", + "../../media:rtc_media_base", + "../../media:turn_utils", + ] +} + +webrtc_fuzzer_test("neteq_rtp_fuzzer") { + sources = [ "neteq_rtp_fuzzer.cc" ] + deps = [ + "../../api:array_view", + "../../api/audio_codecs:builtin_audio_decoder_factory", + "../../modules/audio_coding:neteq", + "../../modules/audio_coding:neteq_test_tools", + "../../modules/audio_coding:neteq_tools_minimal", + "../../modules/audio_coding:pcm16b", + "../../modules/rtp_rtcp:rtp_rtcp_format", + ] +} + +webrtc_fuzzer_test("neteq_signal_fuzzer") { + sources = [ "neteq_signal_fuzzer.cc" ] + deps = [ + "../../api:array_view", + "../../api/audio_codecs:builtin_audio_decoder_factory", + "../../modules/audio_coding:neteq", + "../../modules/audio_coding:neteq_test_tools", + "../../modules/audio_coding:neteq_tools_minimal", + "../../modules/audio_coding:pcm16b", + "../../rtc_base:random", + "../../rtc_base:safe_conversions", + ] +} + +webrtc_fuzzer_test("residual_echo_detector_fuzzer") { + sources = [ "residual_echo_detector_fuzzer.cc" ] + deps = [ + "../../api/audio:echo_detector_creator", + "../../rtc_base:checks", + "../../rtc_base:refcount", + ] +} + +webrtc_fuzzer_test("sdp_parser_fuzzer") { + sources = [ "sdp_parser_fuzzer.cc" ] + deps = [ + "../../api:libjingle_peerconnection_api", + "../../pc:libjingle_peerconnection", + ] + seed_corpus = "corpora/sdp-corpus" +} + +if (!build_with_chromium) { + # This target depends on test infrastructure that can't be built + # with Chromium at the moment. + # TODO(bugs.chromium.org/12534): Make this fuzzer build in Chromium. + + webrtc_fuzzer_test("sdp_integration_fuzzer") { + sources = [ "sdp_integration_fuzzer.cc" ] + deps = [ + "../../api:libjingle_peerconnection_api", + "../../pc:integration_test_helpers", + "../../pc:libjingle_peerconnection", + "../../test:test_support", + ] + absl_deps = [ "//third_party/abseil-cpp/absl/strings" ] + seed_corpus = "corpora/sdp-corpus" + } +} + +webrtc_fuzzer_test("stun_parser_fuzzer") { + sources = [ "stun_parser_fuzzer.cc" ] + deps = [ + "../../api/transport:stun_types", + "../../p2p:rtc_p2p", + ] + seed_corpus = "corpora/stun-corpus" + dict = "corpora/stun.tokens" +} + +webrtc_fuzzer_test("stun_validator_fuzzer") { + sources = [ "stun_validator_fuzzer.cc" ] + deps = [ + "../../api/transport:stun_types", + "../../p2p:rtc_p2p", + ] + seed_corpus = "corpora/stun-corpus" + dict = "corpora/stun.tokens" +} + +webrtc_fuzzer_test("pseudotcp_parser_fuzzer") { + sources = [ "pseudotcp_parser_fuzzer.cc" ] + deps = [ + "../../p2p:rtc_p2p", + "../../rtc_base:threading", + ] +} + +rtc_library("audio_processing_fuzzer_helper") { + testonly = true + sources = [ + "audio_processing_fuzzer_helper.cc", + "audio_processing_fuzzer_helper.h", + ] + deps = [ + ":fuzz_data_helper", + "../../api/audio:audio_frame_api", + "../../modules/audio_processing", + "../../modules/audio_processing:api", + "../../modules/audio_processing:audio_frame_proxies", + "../../rtc_base:checks", + ] + absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] +} + +webrtc_fuzzer_test("audio_processing_fuzzer") { + sources = [ "audio_processing_configs_fuzzer.cc" ] + deps = [ + ":audio_processing_fuzzer_helper", + "../../api:scoped_refptr", + "../../api/audio:aec3_factory", + "../../api/audio:echo_detector_creator", + "../../api/task_queue:default_task_queue_factory", + "../../modules/audio_processing", + "../../modules/audio_processing:api", + "../../modules/audio_processing:audio_buffer", + "../../modules/audio_processing:audioproc_test_utils", + "../../modules/audio_processing/aec3", + "../../modules/audio_processing/aec_dump", + "../../modules/audio_processing/aec_dump:aec_dump_impl", + "../../rtc_base:macromagic", + "../../rtc_base:rtc_task_queue", + "../../rtc_base:safe_minmax", + "../../system_wrappers:field_trial", + ] + absl_deps = [ "//third_party/abseil-cpp/absl/memory" ] + seed_corpus = "corpora/audio_processing-corpus" +} + +webrtc_fuzzer_test("audio_processing_sample_rate_fuzzer") { + sources = [ "audio_processing_sample_rate_fuzzer.cc" ] + deps = [ + "../../api:scoped_refptr", + "../../api/audio:audio_frame_api", + "../../modules/audio_processing", + "../../modules/audio_processing:api", + "../../modules/audio_processing:audio_frame_proxies", + "../../modules/audio_processing:audioproc_test_utils", + "../../rtc_base:checks", + "../../rtc_base:macromagic", + "../../rtc_base:safe_minmax", + ] +} + +webrtc_fuzzer_test("agc_fuzzer") { + sources = [ "agc_fuzzer.cc" ] + deps = [ + ":fuzz_data_helper", + "../../modules/audio_processing", + "../../modules/audio_processing:api", + "../../modules/audio_processing:audio_buffer", + "../../rtc_base:macromagic", + "../../rtc_base:safe_minmax", + ] + + seed_corpus = "corpora/agc-corpus" +} + +webrtc_fuzzer_test("aec3_config_json_fuzzer") { + sources = [ "aec3_config_json_fuzzer.cc" ] + deps = [ + ":fuzz_data_helper", + "../../api/audio:aec3_config", + "../../modules/audio_processing:aec3_config_json", + ] + dict = "//testing/libfuzzer/fuzzers/dicts/json.dict" + seed_corpus = "corpora/aec3-config-json-corpus" +} + +webrtc_fuzzer_test("aec3_fuzzer") { + defines = [] + if (apm_debug_dump) { + defines += [ "WEBRTC_APM_DEBUG_DUMP=1" ] + } else { + defines += [ "WEBRTC_APM_DEBUG_DUMP=0" ] + } + sources = [ "aec3_fuzzer.cc" ] + deps = [ + ":fuzz_data_helper", + "../../modules/audio_processing:api", + "../../modules/audio_processing:audio_buffer", + "../../modules/audio_processing/aec3", + ] + absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] +} + +webrtc_fuzzer_test("comfort_noise_decoder_fuzzer") { + sources = [ "comfort_noise_decoder_fuzzer.cc" ] + deps = [ + "../../api:array_view", + "../../modules/audio_coding:webrtc_cng", + "../../rtc_base:buffer", + ] +} + +webrtc_fuzzer_test("rtp_depacketizer_av1_assemble_frame_fuzzer") { + sources = [ "rtp_depacketizer_av1_assemble_frame_fuzzer.cc" ] + seed_corpus = "corpora/rtp-depacketizer-av1-assemble-frame-corpus" + deps = [ + ":fuzz_data_helper", + "../../api:array_view", + "../../modules/rtp_rtcp", + ] +} + +webrtc_fuzzer_test("rtp_dependency_descriptor_fuzzer") { + sources = [ "rtp_dependency_descriptor_fuzzer.cc" ] + seed_corpus = "corpora/dependency_descriptor-corpus" + deps = [ + "../../api:array_view", + "../../common_video/generic_frame_descriptor", + "../../modules/rtp_rtcp:rtp_rtcp_format", + "../../rtc_base:checks", + ] +} + +webrtc_fuzzer_test("rtp_video_layers_allocation_fuzzer") { + sources = [ "rtp_video_layers_allocation_fuzzer.cc" ] + seed_corpus = "corpora/video_layers_allocation-corpus" + deps = [ + "../../api:array_view", + "../../api/video:video_layers_allocation", + "../../modules/rtp_rtcp:rtp_rtcp_format", + "../../rtc_base:checks", + ] + + # video_layers_allocation is an rtp header extension and thus can't be longer + # than 255 bytes on the wire. + libfuzzer_options = [ "max_len=255" ] +} + +webrtc_fuzzer_test("rtp_frame_reference_finder_fuzzer") { + sources = [ "rtp_frame_reference_finder_fuzzer.cc" ] + deps = [ + "../../api:rtp_packet_info", + "../../api:scoped_refptr", + "../../modules/rtp_rtcp", + "../../modules/video_coding:video_coding", + "../../system_wrappers", + ] +} + +webrtc_fuzzer_test("frame_buffer_fuzzer") { + sources = [ "frame_buffer_fuzzer.cc" ] + deps = [ + ":fuzz_data_helper", + "../../api:array_view", + "../../api/video:encoded_frame", + "../../api/video:frame_buffer", + "../../rtc_base:rtc_numerics", + "../../test:scoped_key_value_config", + ] +} + +webrtc_fuzzer_test("field_trial_fuzzer") { + sources = [ "field_trial_fuzzer.cc" ] + deps = [ "../../system_wrappers:field_trial" ] + seed_corpus = "corpora/field_trial-corpus" +} + +webrtc_fuzzer_test("string_to_number_fuzzer") { + sources = [ "string_to_number_fuzzer.cc" ] + deps = [ "../../rtc_base:stringutils" ] + seed_corpus = "corpora/string_to_number-corpus" +} + +webrtc_fuzzer_test("sctp_utils_fuzzer") { + sources = [ "sctp_utils_fuzzer.cc" ] + deps = [ + "../../api:libjingle_peerconnection_api", + "../../pc:libjingle_peerconnection", + "../../pc:sctp_utils", + "../../rtc_base:copy_on_write_buffer", + ] +} + +webrtc_fuzzer_test("dcsctp_socket_fuzzer") { + sources = [ "dcsctp_socket_fuzzer.cc" ] + deps = [ + "../../net/dcsctp/fuzzers:dcsctp_fuzzers", + "../../net/dcsctp/public:socket", + "../../net/dcsctp/public:types", + "../../net/dcsctp/socket:dcsctp_socket", + "../../rtc_base:logging", + ] +} + +webrtc_fuzzer_test("ssl_certificate_fuzzer") { + sources = [ "ssl_certificate_fuzzer.cc" ] + deps = [ + "../:rtp_test_utils", + "../../rtc_base:ssl", + "../../rtc_base:stringutils", + ] +} + +webrtc_fuzzer_test("vp8_replay_fuzzer") { + sources = [ "vp8_replay_fuzzer.cc" ] + deps = [ "utils:rtp_replayer" ] + seed_corpus = "corpora/rtpdump-corpus/vp8" +} + +if (rtc_build_libvpx) { + webrtc_fuzzer_test("vp9_encoder_references_fuzzer") { + sources = [ "vp9_encoder_references_fuzzer.cc" ] + deps = [ + "..:test_support", + "../../api:array_view", + "../../api:field_trials_view", + "../../api/video:video_frame", + "../../api/video_codecs:video_codecs_api", + "../../media:media_constants", + "../../modules/video_coding:frame_dependencies_calculator", + "../../modules/video_coding:webrtc_libvpx_interface", + "../../modules/video_coding:webrtc_vp9", + "../../rtc_base:safe_compare", + rtc_libvpx_dir, + ] + absl_deps = [ + "//third_party/abseil-cpp/absl/algorithm:container", + "//third_party/abseil-cpp/absl/base:core_headers", + "//third_party/abseil-cpp/absl/container:inlined_vector", + ] + seed_corpus = "corpora/vp9-encoder-references-corpus" + defines = [ "RTC_ENABLE_VP9" ] + } +} + +webrtc_fuzzer_test("vp9_replay_fuzzer") { + sources = [ "vp9_replay_fuzzer.cc" ] + deps = [ "utils:rtp_replayer" ] + seed_corpus = "corpora/rtpdump-corpus/vp9" +} |