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

Commit 2643eeaa authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Added automotiveSvV1.0_fuzzer" am: 91722e38 am: 0b46c261 am: a9277316 am: fa8f29cf

parents 578f43c2 fa8f29cf
Loading
Loading
Loading
Loading
+15 −3
Original line number Original line Diff line number Diff line
@@ -29,9 +29,7 @@ cc_binary {
    relative_install_path: "hw",
    relative_install_path: "hw",
    srcs: [
    srcs: [
        "service.cpp",
        "service.cpp",
        "SurroundViewService.cpp",
        ":automotiveSvV1.0_sources",
        "SurroundView2dSession.cpp",
        "SurroundView3dSession.cpp",
    ],
    ],
    init_rc: ["android.hardware.automotive.sv@1.0-service.rc"],
    init_rc: ["android.hardware.automotive.sv@1.0-service.rc"],
    vintf_fragments: ["android.hardware.automotive.sv@1.0-service.xml"],
    vintf_fragments: ["android.hardware.automotive.sv@1.0-service.xml"],
@@ -54,3 +52,17 @@ cc_binary {
        "-g",
        "-g",
    ],
    ],
}
}

filegroup {
    name: "automotiveSvV1.0_sources",
    srcs: [
        "SurroundViewService.cpp",
        "SurroundView2dSession.cpp",
        "SurroundView3dSession.cpp",
    ],
}

cc_library_headers {
    name: "automotiveSvV1.0_headers",
    export_include_dirs: ["."],
}
+42 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2022 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.
 *
 */

cc_fuzz {
    name: "automotiveSvV1.0_fuzzer",
    srcs: [
        "AutomotiveSvV1_0Fuzzer.cpp",
        "SurroundViewStream.cpp",
        ":automotiveSvV1.0_sources",
    ],
    header_libs: [
        "automotiveSvV1.0_headers",
    ],
    shared_libs: [
        "android.hardware.automotive.sv@1.0",
        "android.hidl.allocator@1.0",
        "libhidlbase",
        "libutils",
        "libhidlmemory",
        "liblog",
    ],
    fuzz_config: {
        cc: [
            "android-media-fuzzing-reports@google.com",
        ],
        componentid: 533764,
    },
}
+433 −0

File added.

Preview size limit exceeded, changes collapsed.

+52 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2022 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.
 *
 */
#pragma once
#include <SurroundViewService.h>
#include <android/hidl/memory/1.0/IMemory.h>
#include <fuzzer/FuzzedDataProvider.h>

namespace android::hardware::automotive::sv::V1_0::implementation::fuzzer {

using ::android::sp;
using ::android::hidl::memory::V1_0::IMemory;

constexpr size_t kMinOverlays = 2;

class SurroundViewFuzzer {
  public:
    SurroundViewFuzzer(const uint8_t* data, size_t size) : mFuzzedDataProvider(data, size) {
        mSurroundViewService = sp<SurroundViewService>::make();
    }
    ~SurroundViewFuzzer() = default;
    void process();

  private:
    void invoke2dSessionAPI();
    void invoke3dSessionAPI();
    std::pair<hidl_memory, sp<IMemory>> getMappedSharedMemory(int32_t bytesSize);
    void initSampleOverlaysData();
    void setIndexOfOverlaysMemory(const std::vector<OverlayMemoryDesc>& overlaysMemDesc,
                                  sp<IMemory> pIMemory, int32_t indexPosition, uint16_t indexValue);
    OverlaysData mOverlaysdata = {};
    size_t mNumOverlays = kMinOverlays;
    sp<IMemory> mMemory = nullptr;
    FuzzedDataProvider mFuzzedDataProvider;
    sp<SurroundViewService> mSurroundViewService = nullptr;
    bool mIs2dStreamStarted = false;
    bool mIs3dStreamStarted = false;
};
}  // namespace android::hardware::automotive::sv::V1_0::implementation::fuzzer
+74 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading