From de9a506270f40873e792a9941457148d4f64e9c4 Mon Sep 17 00:00:00 2001 From: huyx Date: Wed, 17 Jul 2024 09:39:03 +0800 Subject: [PATCH 01/10] =?UTF-8?q?FUZ=E7=94=A8=E4=BE=8B=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- framework/test/fuzztest/BUILD.gn | 4 ++ .../devsvcmanagerstub_fuzzer.cpp | 1 + .../syscall_fuzzer/syscall_fuzzer/BUILD.gn | 44 ++++++++++++++ .../syscall_fuzzer/syscall_fuzzer/corpus/init | 7 +++ .../syscall_fuzzer/syscall_fuzzer/project.xml | 17 ++++++ .../syscall_fuzzer/syscall_fuzzer.cpp | 57 +++++++++++++++++++ .../syscall_fuzzer/syscall_fuzzer.h | 14 +++++ .../collector_fuzzer/BUILD.gn | 47 +++++++++++++++ .../collector_fuzzer/collector_fuzzer.cpp | 46 +++++++++++++++ .../collector_fuzzer/collector_fuzzer.h | 14 +++++ .../collector_fuzzer/corpus/init | 7 +++ .../collector_fuzzer/project.xml | 17 ++++++ .../uhdf2_ipc_fuzzer/ipc_fuzzer/BUILD.gn | 42 ++++++++++++++ .../uhdf2_ipc_fuzzer/ipc_fuzzer/corpus/init | 7 +++ .../ipc_fuzzer/hdfipc_fuzzer.cpp | 49 ++++++++++++++++ .../ipc_fuzzer/hdfipc_fuzzer.h | 14 +++++ .../uhdf2_ipc_fuzzer/ipc_fuzzer/project.xml | 17 ++++++ .../shared_fuzzer/BUILD.gn | 54 ++++++++++++++++++ .../shared_fuzzer/corpus/init | 7 +++ .../shared_fuzzer/project.xml | 17 ++++++ .../shared_fuzzer/shared_fuzzer.cpp | 36 ++++++++++++ .../shared_fuzzer/shared_fuzzer.h | 14 +++++ 22 files changed, 532 insertions(+) create mode 100644 framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn create mode 100644 framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/corpus/init create mode 100644 framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/project.xml create mode 100644 framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/syscall_fuzzer.cpp create mode 100644 framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/syscall_fuzzer.h create mode 100644 framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn create mode 100644 framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp create mode 100644 framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.h create mode 100644 framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/corpus/init create mode 100644 framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/project.xml create mode 100644 framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/BUILD.gn create mode 100644 framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/corpus/init create mode 100644 framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/hdfipc_fuzzer.cpp create mode 100644 framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/hdfipc_fuzzer.h create mode 100644 framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/project.xml create mode 100644 framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn create mode 100644 framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/corpus/init create mode 100644 framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/project.xml create mode 100644 framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/shared_fuzzer.cpp create mode 100644 framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/shared_fuzzer.h diff --git a/framework/test/fuzztest/BUILD.gn b/framework/test/fuzztest/BUILD.gn index df30ea30a..99796db8e 100644 --- a/framework/test/fuzztest/BUILD.gn +++ b/framework/test/fuzztest/BUILD.gn @@ -28,5 +28,9 @@ group("hdf_framework_fuzztest") { "servmgr_cpp_fuzzer/unregisterservicestatuslistener_fuzzer:UnregisterServiceStatusListenerFuzzTest", "uhdf2_utils_fuzzer/hdfxcollie_fuzzer:HdfXCollieFuzzTest", "uhdf2_utils_fuzzer/inner_api_utils_fuzzer:HdfInnerApiUtilsFuzzTest", + "uhdf2_ipc_fuzzer/ipc_fuzzer:HdfIpcFuzzTest", + "uhdf2_hdi_fuzzer/collector_fuzzer:CollectionFuzzTest", + "uhdf2_shared_fuzzer/shared_fuzzer:SharedFuzzTest", + "syscall_fuzzer/syscall_fuzzer:SyscallFuzzTest", ] } diff --git a/framework/test/fuzztest/devsvcmanagerstub_fuzzer/devsvcmanagerstub_fuzzer.cpp b/framework/test/fuzztest/devsvcmanagerstub_fuzzer/devsvcmanagerstub_fuzzer.cpp index 587dd8bf0..2dc432b82 100644 --- a/framework/test/fuzztest/devsvcmanagerstub_fuzzer/devsvcmanagerstub_fuzzer.cpp +++ b/framework/test/fuzztest/devsvcmanagerstub_fuzzer/devsvcmanagerstub_fuzzer.cpp @@ -68,6 +68,7 @@ static bool DevsvcManagerFuzzTest(int32_t code, const uint8_t *data, size_t size HDF_LOGE("%{public}s:%{public}d: failed to get DevSvcManagerStub object", __func__, __LINE__); return false; } + instance->recipient.OnRemoteDied(nullptr, nullptr); struct HdfSBuf *dataBuf = HdfSbufTypedObtain(SBUF_IPC); if (dataBuf == nullptr) { diff --git a/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn new file mode 100644 index 000000000..11e632412 --- /dev/null +++ b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# +# HDF is dual licensed: you can use it either under the terms of +# the GPL, or the BSD license, at your option. +# See the LICENSE file in the root of this repository for complete details. + +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +module_output_path = "hdf_core/hdf_core/syscall_fuzzer" + +hdf_framework_path = "../../../../../framework" +hdf_uhdf_path = "../../../../../adapter/uhdf2" +hdf_interfaces_path = "../../../../interfaces" + +ohos_fuzztest("SyscallFuzzTest") { + module_out_path = module_output_path + + fuzz_config_file = + "$hdf_framework_path/test/fuzztest/syscall_fuzzer/syscall_fuzzer" + + include_dirs = [ + "$hdf_uhdf_path/manager/include", + "//commonlibrary/c_utils/base/include", + "$hdf_framework_path/core/adapter/syscall/include", + "$hdf_interfaces_path/inner_api/osal/shared", + ] + + sources = [ "syscall_fuzzer.cpp" ] + deps = [ + "../../../../../adapter/uhdf2/utils:libhdf_utils", + ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + ] +} + +group("fuzztest") { + testonly = true + deps = [ ":SyscallFuzzTest" ] +} diff --git a/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/corpus/init b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/corpus/init new file mode 100644 index 000000000..f707fb4e4 --- /dev/null +++ b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/corpus/init @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# +# HDF is dual licensed: you can use it either under the terms of +# the GPL, or the BSD license, at your option. +# See the LICENSE file in the root of this repository for complete details. + +FUZZ \ No newline at end of file diff --git a/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/project.xml b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/project.xml new file mode 100644 index 000000000..e47b18640 --- /dev/null +++ b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/project.xml @@ -0,0 +1,17 @@ + + + + + + 1000 + + 120 + + 2048 + + diff --git a/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/syscall_fuzzer.cpp b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/syscall_fuzzer.cpp new file mode 100644 index 000000000..2b42231a3 --- /dev/null +++ b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/syscall_fuzzer.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * + * HDF is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * See the LICENSE file in the root of this repository for complete details. + */ +#include "hdf_base.h" +#include "hdf_log.h" +#include +#include "hdf_io_service_if.h" +#include "syscall_fuzzer.h" +#include "parcel.h" +#include "hdf_io_service.h" +#include +#include +#include "osal_mem.h" + +namespace OHOS { +static void SyscallFuzzTest(const uint8_t *data, size_t size) +{ + if (data == nullptr) { + HDF_LOGE("%{public}s: data is nullptr!", __func__); + } + + struct HdfSBuf *reply = HdfSbufObtainDefaultSize(); + HdfListAllDevice(reply); + HdfListAllService(reply); + + Parcel parcel; + parcel.WriteBuffer(data, size); + struct HdfDevEventlistener *listener = nullptr; + listener = (struct HdfDevEventlistener *)OsalMemCalloc(sizeof(struct HdfDevEventlistener)); + auto servicename = parcel.ReadCString(); + struct HdfIoService *serv = HdfIoServiceBind(servicename); + if (serv == nullptr) { + HDF_LOGE("%{public}s: HdfIoServiceBind failed!", __func__); + } + if (HdfDeviceRegisterEventListener(serv, listener) == HDF_SUCCESS) { + int ret = HdfDeviceUnregisterEventListener(serv, listener); + if (ret != HDF_SUCCESS) { + HdfIoServiceRecycle(serv); + } + } + OsalMemFree(listener); + HdfIoServiceRecycle(serv); +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + + /* Run your code on data */ + OHOS::SyscallFuzzTest(data, size); + return HDF_SUCCESS; +} \ No newline at end of file diff --git a/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/syscall_fuzzer.h b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/syscall_fuzzer.h new file mode 100644 index 000000000..f5a265967 --- /dev/null +++ b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/syscall_fuzzer.h @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * + * HDF is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * See the LICENSE file in the root of this repository for complete details. + */ + +#ifndef HDI_COLLECTION_FUZZER_H +#define HDI_COLLECTION_FUZZER_H + +#define FUZZ_PROJECT_NAME "syscall_fuzzer" + +#endif // HDI_COLLECTION_FUZZER_H \ No newline at end of file diff --git a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn new file mode 100644 index 000000000..582e1b492 --- /dev/null +++ b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn @@ -0,0 +1,47 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# +# HDF is dual licensed: you can use it either under the terms of +# the GPL, or the BSD license, at your option. +# See the LICENSE file in the root of this repository for complete details. + +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +module_output_path = "hdf_core/hdf_core/uhdf2_hdi_fuzzer" + +hdf_framework_path = "../../../../../framework" +hdf_uhdf_path = "../../../../../adapter/uhdf2" +hdf_interfaces_path = "../../../../interfaces" + +ohos_fuzztest("CollectionFuzzTest") { + module_out_path = module_output_path + + fuzz_config_file = + "$hdf_framework_path/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer" + + include_dirs = [ + "$hdf_uhdf_path/utils/include", + "$hdf_uhdf_path/hdi/include", + "$hdf_framework_path/include", + "$hdf_interfaces_path/inner_api/hdi", + ] + + sources = [ "collector_fuzzer.cpp" ] + + deps = [ + "../../../../../adapter/uhdf2/utils:libhdf_utils", + ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + "$hdf_uhdf_path/hdi:libhdi", + "ipc:ipc_single", + ] +} + +group("fuzztest") { + testonly = true + deps = [ ":CollectionFuzzTest" ] +} diff --git a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp new file mode 100644 index 000000000..fa1c6c458 --- /dev/null +++ b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * + * HDF is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * See the LICENSE file in the root of this repository for complete details. + */ +#include "collector_fuzzer.h" +#include "object_collector.h" +#include "hdf_base.h" +#include "hdf_log.h" +#include "parcel.h" +#include +#include "osal_mem.h" +#include "hdi_support.h" +#include + +namespace OHOS { +static void CollectionFuzzTest(const uint8_t *data, size_t size) +{ + if (data == nullptr) { + HDF_LOGE("%{public}s: data is nullptr!", __func__); + } + + Parcel parcel; + parcel.WriteBuffer(data, size); + const std ::string a = parcel.ReadString(); + const std::u16string INTERFACE_NAME = OHOS::Str8ToStr16(parcel.ReadString()); + const char *desc = a.c_str(); + HDI::HdiBase *service = (HDI::HdiBase *)OsalMemCalloc(sizeof(HDI::HdiBase)); + HDI::ObjectCollector *collector; + collector->NewObject(service, INTERFACE_NAME); + collector->GetOrNewObject(service, INTERFACE_NAME); + collector->RemoveObject(service); + OsalMemFree(service); +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + + /* Run your code on data */ + OHOS::CollectionFuzzTest(data, size); + return HDF_SUCCESS; +} \ No newline at end of file diff --git a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.h b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.h new file mode 100644 index 000000000..9b26247a8 --- /dev/null +++ b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.h @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * + * HDF is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * See the LICENSE file in the root of this repository for complete details. + */ + +#ifndef HDI_COLLECTION_FUZZER_H +#define HDI_COLLECTION_FUZZER_H + +#define FUZZ_PROJECT_NAME "collector_fuzzer" + +#endif // HDI_COLLECTION_FUZZER_H \ No newline at end of file diff --git a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/corpus/init b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/corpus/init new file mode 100644 index 000000000..f707fb4e4 --- /dev/null +++ b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/corpus/init @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# +# HDF is dual licensed: you can use it either under the terms of +# the GPL, or the BSD license, at your option. +# See the LICENSE file in the root of this repository for complete details. + +FUZZ \ No newline at end of file diff --git a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/project.xml b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/project.xml new file mode 100644 index 000000000..e47b18640 --- /dev/null +++ b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/project.xml @@ -0,0 +1,17 @@ + + + + + + 1000 + + 120 + + 2048 + + diff --git a/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/BUILD.gn b/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/BUILD.gn new file mode 100644 index 000000000..ed2f7b907 --- /dev/null +++ b/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# +# HDF is dual licensed: you can use it either under the terms of +# the GPL, or the BSD license, at your option. +# See the LICENSE file in the root of this repository for complete details. + +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +module_output_path = "hdf_core/hdf_core/uhdf2_ipc_fuzzer" + +hdf_framework_path = "../../../../../framework" +hdf_uhdf_path = "../../../../../adapter/uhdf2" + +ohos_fuzztest("HdfIpcFuzzTest") { + module_out_path = module_output_path + + fuzz_config_file = + "$hdf_framework_path/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer" + + include_dirs = [ + "$hdf_uhdf_path/utils/include", + "$hdf_uhdf_path/ipc/include", + "$hdf_framework_path/include", + ] + + sources = [ "hdfipc_fuzzer.cpp" ] + deps = ["../../../../../adapter/uhdf2/utils:libhdf_utils",] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + "hdf_core:libhdf_ipc_adapter", + "ipc:ipc_single", + ] +} + +group("fuzztest") { + testonly = true + deps = [ ":HdfIpcFuzzTest" ] +} diff --git a/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/corpus/init b/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/corpus/init new file mode 100644 index 000000000..f707fb4e4 --- /dev/null +++ b/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/corpus/init @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# +# HDF is dual licensed: you can use it either under the terms of +# the GPL, or the BSD license, at your option. +# See the LICENSE file in the root of this repository for complete details. + +FUZZ \ No newline at end of file diff --git a/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/hdfipc_fuzzer.cpp b/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/hdfipc_fuzzer.cpp new file mode 100644 index 000000000..a80395f4e --- /dev/null +++ b/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/hdfipc_fuzzer.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * + * HDF is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * See the LICENSE file in the root of this repository for complete details. + */ + +#include "hdfipc_fuzzer.h" +#include "hdf_remote_adapter.h" +#include "hdf_log.h" +#include "parcel.h" +#include +#include +#include "hdf_base.h" + +namespace OHOS { +static void HdfIpcFuzzTest(const uint8_t *data, size_t size) +{ + if (data == nullptr) { + HDF_LOGE("%{public}s: data is nullptr!", __func__); + } + + Parcel parcel; + parcel.WriteBuffer(data, size); + const char *interfaceName = parcel.ReadCString(); + + struct HdfRemoteService *service = HdfRemoteAdapterObtain(); + if (service == nullptr) { + HDF_LOGE("%{public}s: serviceSet is nullptr!", __func__); + } + + HdfRemoteAdapterAddService(interfaceName, service); + HdfRemoteAdapterGetService(interfaceName); + + struct HdfDeathRecipient* recipient = nullptr; + HdfRemoteAdapterAddDeathRecipient(service, recipient); + HdfRemoteAdapterRemoveDeathRecipient(service, recipient); +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + + /* Run your code on data */ + OHOS::HdfIpcFuzzTest(data, size); + return HDF_SUCCESS; +} \ No newline at end of file diff --git a/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/hdfipc_fuzzer.h b/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/hdfipc_fuzzer.h new file mode 100644 index 000000000..ad1de3ab5 --- /dev/null +++ b/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/hdfipc_fuzzer.h @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * + * HDF is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * See the LICENSE file in the root of this repository for complete details. + */ + +#ifndef IPC_ONREMOTEREQUEST_FUZZER_H +#define IPC_ONREMOTEREQUEST_FUZZER_H + +#define FUZZ_PROJECT_NAME "hdfipc_fuzzer" + +#endif // IPC_ONREMOTEREQUEST_FUZZER_H \ No newline at end of file diff --git a/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/project.xml b/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/project.xml new file mode 100644 index 000000000..e47b18640 --- /dev/null +++ b/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/project.xml @@ -0,0 +1,17 @@ + + + + + + 1000 + + 120 + + 2048 + + diff --git a/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn new file mode 100644 index 000000000..75bb8a0f7 --- /dev/null +++ b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn @@ -0,0 +1,54 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# +# HDF is dual licensed: you can use it either under the terms of +# the GPL, or the BSD license, at your option. +# See the LICENSE file in the root of this repository for complete details. + +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +module_output_path = "hdf_core/hdf_core/uhdf2_shared_fuzzer" + +hdf_framework_path = "../../../../../framework" +hdf_uhdf_path = "../../../../../adapter/uhdf2" + +ohos_fuzztest("SharedFuzzTest") { + module_out_path = module_output_path + + fuzz_config_file = + "$hdf_framework_path/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer" + + include_dirs = [ + "$hdf_uhdf_path/shared/include", + "$hdf_uhdf_path/utils/include", + "$hdf_uhdf_path/ipc/include", + "$hdf_framework_path/include", + "$hdf_framework_path/include", + "$hdf_framework_path/core/manager/include", + "$hdf_framework_path/core/common/include/manager/", + "$hdf_framework_path/core/host/include", + "$hdf_framework_path/core/shared/include", + "$hdf_framework_path/utils/include", + ] + + sources = [ + "shared_fuzzer.cpp", + ] + deps = [ + "../../../../../adapter/uhdf2/utils:libhdf_utils", + "../../../../../adapter/uhdf2/host:libhdf_host", + ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + "ipc:ipc_single", + "init:libbegetutil", + ] +} + +group("fuzztest") { + testonly = true + deps = [ ":SharedFuzzTest" ] +} diff --git a/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/corpus/init b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/corpus/init new file mode 100644 index 000000000..f707fb4e4 --- /dev/null +++ b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/corpus/init @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# +# HDF is dual licensed: you can use it either under the terms of +# the GPL, or the BSD license, at your option. +# See the LICENSE file in the root of this repository for complete details. + +FUZZ \ No newline at end of file diff --git a/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/project.xml b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/project.xml new file mode 100644 index 000000000..e47b18640 --- /dev/null +++ b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/project.xml @@ -0,0 +1,17 @@ + + + + + + 1000 + + 120 + + 2048 + + diff --git a/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/shared_fuzzer.cpp b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/shared_fuzzer.cpp new file mode 100644 index 000000000..6a64995be --- /dev/null +++ b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/shared_fuzzer.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * + * HDF is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * See the LICENSE file in the root of this repository for complete details. + */ +#include "shared_fuzzer.h" +#include "dev_attribute_serialize.h" +#include "hdf_base.h" +#include "hdf_log.h" +#include + +namespace OHOS { +static void SharedFuzzTest(const uint8_t *data, size_t size) +{ + if (data == nullptr) { + HDF_LOGE("%{public}s: data is nullptr!", __func__); + } + + struct HdfDeviceInfo *attribute = (struct HdfDeviceInfo *)data; + struct HdfSBuf *sbuf = (struct HdfSBuf *)data; + DeviceAttributeSerialize(attribute, sbuf); + DeviceAttributeDeserialize(sbuf); + DeviceSerializedAttributeRelease(attribute); +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + + /* Run your code on data */ + OHOS::SharedFuzzTest(data, size); + return HDF_SUCCESS; +} \ No newline at end of file diff --git a/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/shared_fuzzer.h b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/shared_fuzzer.h new file mode 100644 index 000000000..f3ed9b94f --- /dev/null +++ b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/shared_fuzzer.h @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * + * HDF is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * See the LICENSE file in the root of this repository for complete details. + */ + +#ifndef HDI_COLLECTION_FUZZER_H +#define HDI_COLLECTION_FUZZER_H + +#define FUZZ_PROJECT_NAME "shared_fuzzer" + +#endif // HDI_COLLECTION_FUZZER_H \ No newline at end of file -- Gitee From 3fd7a863a416810fc8bd80d4158fd6a801a0133d Mon Sep 17 00:00:00 2001 From: huyx Date: Wed, 17 Jul 2024 09:50:35 +0800 Subject: [PATCH 02/10] =?UTF-8?q?FUZ=E7=94=A8=E4=BE=8B=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- .../fuzztest/syscall_fuzzer/syscall_fuzzer/syscall_fuzzer.cpp | 1 - .../uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp | 1 - .../test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/hdfipc_fuzzer.cpp | 1 - .../fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/shared_fuzzer.cpp | 1 - 4 files changed, 4 deletions(-) diff --git a/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/syscall_fuzzer.cpp b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/syscall_fuzzer.cpp index 2b42231a3..5f09ecbfc 100644 --- a/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/syscall_fuzzer.cpp +++ b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/syscall_fuzzer.cpp @@ -50,7 +50,6 @@ static void SyscallFuzzTest(const uint8_t *data, size_t size) /* Fuzzer entry point */ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - /* Run your code on data */ OHOS::SyscallFuzzTest(data, size); return HDF_SUCCESS; diff --git a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp index fa1c6c458..2518d44eb 100644 --- a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp +++ b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp @@ -39,7 +39,6 @@ static void CollectionFuzzTest(const uint8_t *data, size_t size) /* Fuzzer entry point */ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - /* Run your code on data */ OHOS::CollectionFuzzTest(data, size); return HDF_SUCCESS; diff --git a/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/hdfipc_fuzzer.cpp b/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/hdfipc_fuzzer.cpp index a80395f4e..a0ab10e19 100644 --- a/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/hdfipc_fuzzer.cpp +++ b/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/hdfipc_fuzzer.cpp @@ -42,7 +42,6 @@ static void HdfIpcFuzzTest(const uint8_t *data, size_t size) /* Fuzzer entry point */ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - /* Run your code on data */ OHOS::HdfIpcFuzzTest(data, size); return HDF_SUCCESS; diff --git a/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/shared_fuzzer.cpp b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/shared_fuzzer.cpp index 6a64995be..0bc30ce59 100644 --- a/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/shared_fuzzer.cpp +++ b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/shared_fuzzer.cpp @@ -29,7 +29,6 @@ static void SharedFuzzTest(const uint8_t *data, size_t size) /* Fuzzer entry point */ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - /* Run your code on data */ OHOS::SharedFuzzTest(data, size); return HDF_SUCCESS; -- Gitee From ffcacd8d87267869a7c6c2c4fbcc481d87cea45b Mon Sep 17 00:00:00 2001 From: huyx Date: Wed, 17 Jul 2024 09:51:39 +0800 Subject: [PATCH 03/10] =?UTF-8?q?FUZ=E7=94=A8=E4=BE=8B=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- .../test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn | 1 - 1 file changed, 1 deletion(-) diff --git a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn index 582e1b492..1414a89af 100644 --- a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn +++ b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn @@ -36,7 +36,6 @@ ohos_fuzztest("CollectionFuzzTest") { external_deps = [ "c_utils:utils", "hilog:libhilog", - "$hdf_uhdf_path/hdi:libhdi", "ipc:ipc_single", ] } -- Gitee From aec7e902c77a5a89f30f9bb9eea54805b6f68574 Mon Sep 17 00:00:00 2001 From: huyx Date: Wed, 17 Jul 2024 10:31:49 +0800 Subject: [PATCH 04/10] =?UTF-8?q?FUZ=E7=94=A8=E4=BE=8B=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- .../test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn | 6 ++---- .../uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp | 4 +--- .../test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/BUILD.gn | 2 +- .../fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn | 6 ++---- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn index 11e632412..2c1d8c696 100644 --- a/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn +++ b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn @@ -18,7 +18,7 @@ ohos_fuzztest("SyscallFuzzTest") { module_out_path = module_output_path fuzz_config_file = - "$hdf_framework_path/test/fuzztest/syscall_fuzzer/syscall_fuzzer" + "$hdf_framework_path/test/fuzztest/syscall_fuzzer/syscall_fuzzer" include_dirs = [ "$hdf_uhdf_path/manager/include", @@ -28,9 +28,7 @@ ohos_fuzztest("SyscallFuzzTest") { ] sources = [ "syscall_fuzzer.cpp" ] - deps = [ - "../../../../../adapter/uhdf2/utils:libhdf_utils", - ] + deps = ["../../../../../adapter/uhdf2/utils:libhdf_utils",] external_deps = [ "c_utils:utils", diff --git a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp index 2518d44eb..5e21f721b 100644 --- a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp +++ b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp @@ -24,11 +24,9 @@ static void CollectionFuzzTest(const uint8_t *data, size_t size) Parcel parcel; parcel.WriteBuffer(data, size); - const std ::string a = parcel.ReadString(); const std::u16string INTERFACE_NAME = OHOS::Str8ToStr16(parcel.ReadString()); - const char *desc = a.c_str(); HDI::HdiBase *service = (HDI::HdiBase *)OsalMemCalloc(sizeof(HDI::HdiBase)); - HDI::ObjectCollector *collector; + HDI::ObjectCollector *collector = (HDI::ObjectCollector *)OsalMemCalloc(sizeof(HDI::ObjectCollector)); collector->NewObject(service, INTERFACE_NAME); collector->GetOrNewObject(service, INTERFACE_NAME); collector->RemoveObject(service); diff --git a/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/BUILD.gn b/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/BUILD.gn index ed2f7b907..e14ce549a 100644 --- a/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/BUILD.gn +++ b/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/BUILD.gn @@ -17,7 +17,7 @@ ohos_fuzztest("HdfIpcFuzzTest") { module_out_path = module_output_path fuzz_config_file = - "$hdf_framework_path/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer" + "$hdf_framework_path/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer" include_dirs = [ "$hdf_uhdf_path/utils/include", diff --git a/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn index 75bb8a0f7..4fd1d3fc8 100644 --- a/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn +++ b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn @@ -17,7 +17,7 @@ ohos_fuzztest("SharedFuzzTest") { module_out_path = module_output_path fuzz_config_file = - "$hdf_framework_path/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer" + "$hdf_framework_path/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer" include_dirs = [ "$hdf_uhdf_path/shared/include", @@ -32,9 +32,7 @@ ohos_fuzztest("SharedFuzzTest") { "$hdf_framework_path/utils/include", ] - sources = [ - "shared_fuzzer.cpp", - ] + sources = [ "shared_fuzzer.cpp", ] deps = [ "../../../../../adapter/uhdf2/utils:libhdf_utils", "../../../../../adapter/uhdf2/host:libhdf_host", -- Gitee From fd68d30d327001693992cb7cc4978afd8edf5030 Mon Sep 17 00:00:00 2001 From: huyx Date: Wed, 17 Jul 2024 11:14:23 +0800 Subject: [PATCH 05/10] =?UTF-8?q?FUZ=E7=94=A8=E4=BE=8B=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- .../test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn | 1 - .../uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn index 2c1d8c696..19ba902b7 100644 --- a/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn +++ b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn @@ -22,7 +22,6 @@ ohos_fuzztest("SyscallFuzzTest") { include_dirs = [ "$hdf_uhdf_path/manager/include", - "//commonlibrary/c_utils/base/include", "$hdf_framework_path/core/adapter/syscall/include", "$hdf_interfaces_path/inner_api/osal/shared", ] diff --git a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp index 5e21f721b..6bb211804 100644 --- a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp +++ b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/collector_fuzzer.cpp @@ -26,10 +26,9 @@ static void CollectionFuzzTest(const uint8_t *data, size_t size) parcel.WriteBuffer(data, size); const std::u16string INTERFACE_NAME = OHOS::Str8ToStr16(parcel.ReadString()); HDI::HdiBase *service = (HDI::HdiBase *)OsalMemCalloc(sizeof(HDI::HdiBase)); - HDI::ObjectCollector *collector = (HDI::ObjectCollector *)OsalMemCalloc(sizeof(HDI::ObjectCollector)); - collector->NewObject(service, INTERFACE_NAME); - collector->GetOrNewObject(service, INTERFACE_NAME); - collector->RemoveObject(service); + HDI::ObjectCollector::GetInstance().NewObject(service, INTERFACE_NAME); + HDI::ObjectCollector::GetInstance().GetOrNewObject(service, INTERFACE_NAME); + HDI::ObjectCollector::GetInstance().RemoveObject(service); OsalMemFree(service); } } -- Gitee From 1c9f2aa35e71db149355002a99a2c323589269b2 Mon Sep 17 00:00:00 2001 From: huyx Date: Wed, 17 Jul 2024 11:38:14 +0800 Subject: [PATCH 06/10] =?UTF-8?q?FUZ=E7=94=A8=E4=BE=8B=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- framework/test/fuzztest/BUILD.gn | 8 ++++---- .../fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/framework/test/fuzztest/BUILD.gn b/framework/test/fuzztest/BUILD.gn index 99796db8e..fa07bb7db 100644 --- a/framework/test/fuzztest/BUILD.gn +++ b/framework/test/fuzztest/BUILD.gn @@ -26,11 +26,11 @@ group("hdf_framework_fuzztest") { "servmgr_c_fuzzer/listservicebyinterfacedesc_fuzzer:ListServiceByInterfaceDescFuzzTest", "servmgr_cpp_fuzzer/servstatlistenerstub_fuzzer:ServStatListenerStubFuzzTest", "servmgr_cpp_fuzzer/unregisterservicestatuslistener_fuzzer:UnregisterServiceStatusListenerFuzzTest", - "uhdf2_utils_fuzzer/hdfxcollie_fuzzer:HdfXCollieFuzzTest", - "uhdf2_utils_fuzzer/inner_api_utils_fuzzer:HdfInnerApiUtilsFuzzTest", - "uhdf2_ipc_fuzzer/ipc_fuzzer:HdfIpcFuzzTest", + "syscall_fuzzer/syscall_fuzzer:SyscallFuzzTest", "uhdf2_hdi_fuzzer/collector_fuzzer:CollectionFuzzTest", + "uhdf2_ipc_fuzzer/ipc_fuzzer:HdfIpcFuzzTest", "uhdf2_shared_fuzzer/shared_fuzzer:SharedFuzzTest", - "syscall_fuzzer/syscall_fuzzer:SyscallFuzzTest", + "uhdf2_utils_fuzzer/hdfxcollie_fuzzer:HdfXCollieFuzzTest", + "uhdf2_utils_fuzzer/inner_api_utils_fuzzer:HdfInnerApiUtilsFuzzTest", ] } diff --git a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn index 1414a89af..2cd1be3c7 100644 --- a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn +++ b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn @@ -31,6 +31,7 @@ ohos_fuzztest("CollectionFuzzTest") { deps = [ "../../../../../adapter/uhdf2/utils:libhdf_utils", + "hdf_uhdf_path/hdi:libhdi", ] external_deps = [ -- Gitee From 7014e2cd4829252c65d935c6a6f5e8631372c8f7 Mon Sep 17 00:00:00 2001 From: huyx Date: Wed, 17 Jul 2024 11:58:57 +0800 Subject: [PATCH 07/10] =?UTF-8?q?FUZ=E7=94=A8=E4=BE=8B=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- .../test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn index 2cd1be3c7..59b8a55c1 100644 --- a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn +++ b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn @@ -31,7 +31,7 @@ ohos_fuzztest("CollectionFuzzTest") { deps = [ "../../../../../adapter/uhdf2/utils:libhdf_utils", - "hdf_uhdf_path/hdi:libhdi", + "../../../../../adapter/uhdf2/hdi:libhdi", ] external_deps = [ -- Gitee From 04fe78feb6d6d28c0a33b52cf9fd910e89c5f229 Mon Sep 17 00:00:00 2001 From: huyx Date: Wed, 17 Jul 2024 14:30:34 +0800 Subject: [PATCH 08/10] =?UTF-8?q?FUZZ=E7=94=A8=E4=BE=8B=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- .../test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn index 19ba902b7..26bc3c26e 100644 --- a/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn +++ b/framework/test/fuzztest/syscall_fuzzer/syscall_fuzzer/BUILD.gn @@ -18,7 +18,7 @@ ohos_fuzztest("SyscallFuzzTest") { module_out_path = module_output_path fuzz_config_file = - "$hdf_framework_path/test/fuzztest/syscall_fuzzer/syscall_fuzzer" + "$hdf_framework_path/test/fuzztest/syscall_fuzzer/syscall_fuzzer" include_dirs = [ "$hdf_uhdf_path/manager/include", @@ -27,7 +27,7 @@ ohos_fuzztest("SyscallFuzzTest") { ] sources = [ "syscall_fuzzer.cpp" ] - deps = ["../../../../../adapter/uhdf2/utils:libhdf_utils",] + deps = [ "../../../../../adapter/uhdf2/utils:libhdf_utils" ] external_deps = [ "c_utils:utils", -- Gitee From 2e2011866c187510643aa6e7fcbb660e83ca7d66 Mon Sep 17 00:00:00 2001 From: huyx Date: Wed, 17 Jul 2024 14:49:09 +0800 Subject: [PATCH 09/10] =?UTF-8?q?FUZZ=E7=94=A8=E4=BE=8B=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- .../fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn | 4 ++-- .../test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/BUILD.gn | 6 +++--- .../fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn index 59b8a55c1..787cd8bbe 100644 --- a/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn +++ b/framework/test/fuzztest/uhdf2_hdi_fuzzer/collector_fuzzer/BUILD.gn @@ -29,9 +29,9 @@ ohos_fuzztest("CollectionFuzzTest") { sources = [ "collector_fuzzer.cpp" ] - deps = [ - "../../../../../adapter/uhdf2/utils:libhdf_utils", + deps = [ "../../../../../adapter/uhdf2/hdi:libhdi", + "../../../../../adapter/uhdf2/utils:libhdf_utils", ] external_deps = [ diff --git a/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/BUILD.gn b/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/BUILD.gn index e14ce549a..73c096d68 100644 --- a/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/BUILD.gn +++ b/framework/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer/BUILD.gn @@ -17,7 +17,7 @@ ohos_fuzztest("HdfIpcFuzzTest") { module_out_path = module_output_path fuzz_config_file = - "$hdf_framework_path/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer" + "$hdf_framework_path/test/fuzztest/uhdf2_ipc_fuzzer/ipc_fuzzer" include_dirs = [ "$hdf_uhdf_path/utils/include", @@ -26,12 +26,12 @@ ohos_fuzztest("HdfIpcFuzzTest") { ] sources = [ "hdfipc_fuzzer.cpp" ] - deps = ["../../../../../adapter/uhdf2/utils:libhdf_utils",] + deps = [ "../../../../../adapter/uhdf2/utils:libhdf_utils" ] external_deps = [ "c_utils:utils", - "hilog:libhilog", "hdf_core:libhdf_ipc_adapter", + "hilog:libhilog", "ipc:ipc_single", ] } diff --git a/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn index 4fd1d3fc8..4989380d5 100644 --- a/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn +++ b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn @@ -17,7 +17,7 @@ ohos_fuzztest("SharedFuzzTest") { module_out_path = module_output_path fuzz_config_file = - "$hdf_framework_path/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer" + "$hdf_framework_path/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer" include_dirs = [ "$hdf_uhdf_path/shared/include", @@ -32,15 +32,16 @@ ohos_fuzztest("SharedFuzzTest") { "$hdf_framework_path/utils/include", ] - sources = [ "shared_fuzzer.cpp", ] + sources = [ "shared_fuzzer.cpp" ] deps = [ - "../../../../../adapter/uhdf2/utils:libhdf_utils", "../../../../../adapter/uhdf2/host:libhdf_host", + "../../../../../adapter/uhdf2/utils:libhdf_utils", ] external_deps = [ "c_utils:utils", "hilog:libhilog", + "init:libbegetutil", "ipc:ipc_single", "init:libbegetutil", ] -- Gitee From 1f3b54b47188248f36888668e6c74ca1945f65ef Mon Sep 17 00:00:00 2001 From: huyx Date: Wed, 17 Jul 2024 16:44:46 +0800 Subject: [PATCH 10/10] =?UTF-8?q?FUZZ=E7=94=A8=E4=BE=8B=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyx --- .../test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn | 1 - 1 file changed, 1 deletion(-) diff --git a/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn index 4989380d5..7a2d731f4 100644 --- a/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn +++ b/framework/test/fuzztest/uhdf2_shared_fuzzer/shared_fuzzer/BUILD.gn @@ -43,7 +43,6 @@ ohos_fuzztest("SharedFuzzTest") { "hilog:libhilog", "init:libbegetutil", "ipc:ipc_single", - "init:libbegetutil", ] } -- Gitee