123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275 |
- # Copyright 2017 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.
- import("//testing/libfuzzer/fuzzer_test.gni")
- import("//third_party/libprotobuf-mutator/fuzzable_proto_library.gni")
- import("//third_party/openscreen/src/build/config/data_headers_template.gni")
- import("//third_party/protobuf/proto_library.gni")
- static_library("cast_channel") {
- sources = [
- "cast_auth_util.cc",
- "cast_auth_util.h",
- "cast_channel_enum.cc",
- "cast_channel_enum.h",
- "cast_framer.cc",
- "cast_framer.h",
- "cast_message_handler.cc",
- "cast_message_handler.h",
- "cast_message_util.cc",
- "cast_message_util.h",
- "cast_socket.cc",
- "cast_socket.h",
- "cast_socket_service.cc",
- "cast_socket_service.h",
- "cast_transport.cc",
- "cast_transport.h",
- "enum_table.cc",
- "enum_table.h",
- "keep_alive_delegate.cc",
- "keep_alive_delegate.h",
- "keep_alive_handler.cc",
- "keep_alive_handler.h",
- "libcast_socket_service.cc",
- "libcast_socket_service.h",
- "logger.cc",
- "logger.h",
- "mojo_data_pump.cc",
- "mojo_data_pump.h",
- ]
- deps = [
- "//base",
- "//build:chromeos_buildflags",
- "//components/cast_certificate",
- "//components/cast_certificate:openscreen_certificate_verifier",
- "//components/keyed_service/content",
- "//components/keyed_service/core",
- "//components/openscreen_platform:openscreen_platform_network_service",
- "//components/prefs",
- "//components/version_info",
- "//content/public/browser",
- "//crypto",
- "//net",
- "//services/data_decoder/public/cpp",
- "//third_party/openscreen/src/cast/common:channel",
- "//third_party/openscreen/src/cast/common/channel/proto:channel_proto",
- "//third_party/openscreen/src/cast/sender:channel",
- "//third_party/openscreen/src/platform",
- ]
- public_deps = [
- "//services/data_decoder/public/cpp",
- "//services/network/public/mojom",
- ]
- }
- static_library("test_support") {
- testonly = true
- sources = [
- "cast_test_util.cc",
- "cast_test_util.h",
- ]
- deps = [
- ":cast_channel",
- "//base",
- "//net",
- "//net:test_support",
- "//services/service_manager/public/cpp",
- "//testing/gmock",
- "//testing/gtest",
- "//third_party/openscreen/src/cast/common/channel/proto:channel_proto",
- ]
- }
- source_set("unit_tests") {
- testonly = true
- sources = [
- "cast_auth_util_unittest.cc",
- "cast_framer_unittest.cc",
- "cast_message_handler_unittest.cc",
- "cast_message_util_unittest.cc",
- "cast_socket_service_unittest.cc",
- "cast_socket_unittest.cc",
- "cast_transport_unittest.cc",
- "enum_table_unittest.cc",
- "keep_alive_delegate_unittest.cc",
- "libcast_socket_service_unittest.cc",
- "logger_unittest.cc",
- ]
- deps = [
- ":cast_channel",
- ":test_support",
- "//base/test:test_support",
- "//components/cast_certificate",
- "//components/cast_certificate:cast_certificate_reader",
- "//components/cast_certificate:test_support",
- "//components/openscreen_platform:openscreen_platform",
- "//components/prefs",
- "//components/prefs:test_support",
- "//content/test:test_support",
- "//net:test_support",
- "//services/data_decoder/public/cpp",
- "//services/data_decoder/public/cpp:test_support",
- "//testing/gmock",
- "//testing/gtest",
- "//third_party/openscreen/src/cast/common:test_helpers",
- "//third_party/openscreen/src/cast/common/certificate/proto:certificate_unittest_proto",
- "//third_party/openscreen/src/cast/common/channel/proto:channel_proto",
- ]
- }
- # TODO(issuetracker.google.com/185815206): Fuzzers should also work with
- # openscreen code.
- if (use_fuzzing_engine) {
- source_set("cast_auth_util_fuzzer_shared") {
- sources = [
- "cast_auth_util_fuzzer_shared.cc",
- "cast_auth_util_fuzzer_shared.h",
- ]
- public_deps = [ ":cast_channel_fuzzer_inputs" ]
- deps = [
- "//third_party/openscreen/src/cast/common/channel/proto:channel_proto",
- ]
- }
- data_headers("cast_auth_util_fuzzer_certs") {
- namespace = "cast"
- sources =
- [ "../test/data/cast_certificate/certificates/chromecast_gen1.pem" ]
- }
- fuzzable_proto_library("cast_channel_fuzzer_inputs") {
- sources = [ "proto/fuzzer_inputs.proto" ]
- import_dirs = [
- "//third_party/openscreen/src/cast/common/certificate/proto",
- "//third_party/openscreen/src/cast/common/channel/proto",
- ]
- link_deps = [
- "//third_party/openscreen/src/cast/common/certificate/proto:certificate_proto",
- "//third_party/openscreen/src/cast/common/channel/proto:channel_proto",
- ]
- proto_out_dir = "components/cast_channel/fuzz_proto"
- }
- protoc_convert("cast_auth_util_fuzzer_convert_corpus") {
- sources = [
- "test/data/error.textproto",
- "test/data/good.textproto",
- ]
- inputs = [ "proto/fuzzer_inputs.proto" ]
- output_pattern = "$target_gen_dir/cast_auth_util_fuzzer_corpus/{{source_name_part}}.binarypb"
- args = [
- "--encode=cast_channel.fuzz.CastAuthUtilInputs",
- "-I",
- rebase_path("//third_party/openscreen/src/cast/common/channel/proto"),
- "-I",
- rebase_path("//third_party/openscreen/src/cast/common/certificate/proto"),
- "-I",
- rebase_path("proto"),
- "fuzzer_inputs.proto",
- ]
- }
- }
- fuzzer_test("cast_auth_util_fuzzer") {
- sources = [ "cast_auth_util_fuzzer.cc" ]
- deps = [
- ":cast_auth_util_fuzzer_certs",
- ":cast_auth_util_fuzzer_shared",
- ":cast_channel",
- ":cast_channel_fuzzer_inputs",
- "//components/cast_certificate",
- "//components/cast_certificate:cast_certificate_reader",
- "//components/cast_certificate:test_support",
- "//net:test_support",
- "//net/data/ssl/certificates:generate_fuzzer_cert_includes",
- "//third_party/libprotobuf-mutator",
- "//third_party/openscreen/src/cast/common/certificate/proto:certificate_proto",
- ]
- seed_corpus = "$target_gen_dir/cast_auth_util_fuzzer_corpus"
- seed_corpus_deps = [ ":cast_auth_util_fuzzer_convert_corpus" ]
- }
- # TODO(crbug.com/1291729): Rename target to cast_framer_ingest_fuzzer. The name
- # is left unchanged for now to avoid the need to get reviews for
- # various files that include it.
- fuzzer_test("cast_message_fuzzer") {
- sources = [ "cast_framer_ingest_fuzzer.cc" ]
- deps = [
- ":test_support",
- "//base",
- "//components/cast_channel",
- "//net",
- "//third_party/openscreen/src/cast/common/channel/proto:channel_proto",
- ]
- seed_corpus = "fuzz_corpus"
- # See MessageFramer::MessageHeader::max_message_size()
- libfuzzer_options = [ "max_len=65535" ]
- }
- fuzzer_test("cast_framer_serialize_fuzzer") {
- sources = [ "cast_framer_serialize_fuzzer.cc" ]
- deps = [
- ":cast_channel",
- ":cast_channel_fuzzer_inputs",
- "//third_party/libprotobuf-mutator",
- "//third_party/openscreen/src/cast/common/channel/proto:channel_proto",
- ]
- }
- fuzzer_test("cast_message_util_fuzzer") {
- sources = [ "cast_message_util_fuzzer.cc" ]
- dict = "fuzz.dict"
- deps = [
- ":cast_channel",
- ":cast_channel_fuzzer_inputs",
- "//third_party/libprotobuf-mutator",
- "//third_party/openscreen/src/cast/common/channel/proto:channel_proto",
- ]
- }
- fuzzer_test("openscreen_cast_auth_util_fuzzer") {
- sources = [ "openscreen_cast_auth_util_fuzzer.cc" ]
- deps = [
- ":cast_auth_util_fuzzer_certs",
- ":cast_auth_util_fuzzer_shared",
- ":cast_channel_fuzzer_inputs",
- "//base",
- "//components/cast_certificate:cast_certificate_reader",
- "//components/openscreen_platform",
- "//net/data/ssl/certificates:generate_fuzzer_cert_includes",
- "//third_party/boringssl",
- "//third_party/libprotobuf-mutator",
- "//third_party/openscreen/src/cast/common:certificate_boringssl",
- "//third_party/openscreen/src/cast/common/certificate/proto:certificate_proto",
- "//third_party/openscreen/src/cast/sender:channel",
- ]
- seed_corpus = "$target_gen_dir/cast_auth_util_fuzzer_corpus"
- seed_corpus_deps = [ ":cast_auth_util_fuzzer_convert_corpus" ]
- }
- fuzzer_test("openscreen_message_framer_deserialize_fuzzer") {
- sources = [ "openscreen_message_framer_deserialize_fuzzer.cc" ]
- deps = [
- "//components/openscreen_platform",
- "//third_party/openscreen/src/cast/common:channel",
- ]
- seed_corpus = "fuzz_corpus"
- # NOTE: Max message size is 65536 + 4, so this allows some overhang.
- libfuzzer_options = [ "max_len=65600" ]
- }
- fuzzer_test("openscreen_message_framer_serialize_fuzzer") {
- sources = [ "openscreen_message_framer_serialize_fuzzer.cc" ]
- deps = [
- ":cast_channel_fuzzer_inputs",
- "//components/openscreen_platform",
- "//third_party/libprotobuf-mutator",
- "//third_party/openscreen/src/cast/common:channel",
- ]
- }
|