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

Commit 33ea3fd7 authored by Pawan Wagh's avatar Pawan Wagh Committed by Automerger Merge Worker
Browse files

Merge "Adding fuzzer for DrmManagerService" am: 3d838ad1

parents d5d22608 3d838ad1
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -63,3 +63,39 @@ cc_binary {

    init_rc: ["drmserver.rc"],
}

cc_fuzz {
    name: "drmserver_fuzzer",

    defaults: [
        "service_fuzzer_defaults",
    ],

    srcs: [
        "fuzzer/DrmFuzzer.cpp",
        "DrmManagerService.cpp",
        "DrmManager.cpp",
    ],

    static_libs: [
        "libmediautils",
        "liblog",
        "libdl",
        "libdrmframeworkcommon",
        "libselinux",
        "libstagefright_foundation",
    ],

     shared_libs: [
         "libmediametrics",
     ],

     fuzz_config: {
         libfuzzer_options: [
             "max_len=50000",
         ],
         cc: [
             "android-drm-team@google.com",
         ],
     },
}
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -141,6 +141,8 @@ public:

    virtual status_t dump(int fd, const Vector<String16>& args);

    friend class DrmManagerServiceFuzzer;

private:
    sp<DrmManager> mDrmManager;
};
+38 −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_driver.h>
#include <fuzzer/FuzzedDataProvider.h>

#include "DrmManagerService.h"

namespace android {
class DrmManagerServiceFuzzer {
public:
    DrmManagerServiceFuzzer() {}

    void fuzz(const uint8_t* data, size_t size) {
          auto drmService = new DrmManagerService();
          fuzzService(drmService, FuzzedDataProvider(data, size));
    }
};
}

extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
    android::DrmManagerServiceFuzzer serviceFuzzer;
    serviceFuzzer.fuzz(data, size);
    return 0;
}
 No newline at end of file