Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8ac5c52 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker Committed by Automerger Merge Worker
Browse files
parents 8979d89d 6e576f72
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
@@ -398,3 +398,45 @@ cc_fuzz {
    defaults: ["resolv_fuzzer_defaults"],
    srcs: ["fuzzer/resolv_getaddrinfo_fuzzer.cpp"],
}

cc_fuzz {
    name: "resolv_service_fuzzer",
    defaults: [
        "resolv_fuzzer_defaults",
    ],
    static_libs: [
        "libstatslog_resolv",
        "libstatspush_compat",
        "libbase",
        "libbinder_random_parcel",
        "libcutils",
    ],
    target: {
        android: {
            shared_libs: [
                "libbinder_ndk",
                "libbinder",
                "libutils",
            ],
        },
        host: {
            static_libs: [
                "libbinder_ndk",
                "libbinder",
                "libutils",
            ],
        },
        darwin: {
            enabled: false,
        },
    },
    fuzz_config: {
        cc: [
            "smoreland@google.com",
            "waghpawan@google.com",
        ],
        // Adds bugs to hotlist "AIDL fuzzer bugs" on buganizer
        hotlists: ["4637097"],
    },
    srcs: ["fuzzer/resolv_service_fuzzer.cpp"],
}
+32 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <fuzzbinder/libbinder_ndk_driver.h>
#include <fuzzer/FuzzedDataProvider.h>

#include <android/binder_interface_utils.h>

#include "DnsResolverService.h"

using android::fuzzService;
using android::net::DnsResolverService;

extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
    auto resolverService = ::ndk::SharedRefBase::make<DnsResolverService>();
    fuzzService(resolverService->asBinder().get(), FuzzedDataProvider(data, size));

    return 0;
}