From 95c266cac7dc6dc119e76ce47ae0ce51e7073a84 Mon Sep 17 00:00:00 2001 From: qinlong0101 Date: Thu, 14 Apr 2022 16:14:43 +0800 Subject: [PATCH 1/5] add screen fuzztest Signed-off-by: qinlong0101 --- bundle.json | 4 +- .../native_cpp/test/fuzztest/BUILD.gn | 22 +++++ .../dscreen_sink_handler_fuzzer/BUILD.gn | 72 +++++++++++++++++ .../dscreen_sink_handler_fuzzer/corpus/init | 14 ++++ .../dscreen_sink_handler_fuzzer.cpp | 59 ++++++++++++++ .../dscreen_sink_handler_fuzzer.h | 24 ++++++ .../dscreen_sink_handler_fuzzer/project.xml | 25 ++++++ .../dscreen_sink_proxy_fuzzer/BUILD.gn | 72 +++++++++++++++++ .../dscreen_sink_proxy_fuzzer/corpus/init | 14 ++++ .../dscreen_sink_proxy_fuzzer.cpp | 63 +++++++++++++++ .../dscreen_sink_proxy_fuzzer.h | 22 +++++ .../dscreen_sink_proxy_fuzzer/project.xml | 25 ++++++ .../dscreen_source_handler_fuzzer/BUILD.gn | 77 ++++++++++++++++++ .../dscreen_source_handler_fuzzer/corpus/init | 14 ++++ .../dscreen_source_handler_fuzzer.cpp | 71 ++++++++++++++++ .../dscreen_source_handler_fuzzer.h | 24 ++++++ .../dscreen_source_handler_fuzzer/project.xml | 25 ++++++ screenhandler/test/fuzztest/BUILD.gn | 20 +++++ .../fuzztest/dscreen_handler_fuzzer/BUILD.gn | 80 +++++++++++++++++++ .../dscreen_handler_fuzzer/corpus/init | 16 ++++ .../dscreen_handler_fuzzer.cpp | 62 ++++++++++++++ .../dscreen_handler_fuzzer.h | 23 ++++++ .../dscreen_handler_fuzzer/project.xml | 25 ++++++ 23 files changed, 852 insertions(+), 1 deletion(-) create mode 100644 interfaces/innerkits/native_cpp/test/fuzztest/BUILD.gn create mode 100644 interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/BUILD.gn create mode 100644 interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/corpus/init create mode 100644 interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.cpp create mode 100644 interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.h create mode 100644 interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/project.xml create mode 100644 interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/BUILD.gn create mode 100644 interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/corpus/init create mode 100644 interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.cpp create mode 100644 interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.h create mode 100644 interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/project.xml create mode 100644 interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/BUILD.gn create mode 100644 interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/corpus/init create mode 100644 interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.cpp create mode 100644 interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.h create mode 100644 interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/project.xml create mode 100644 screenhandler/test/fuzztest/BUILD.gn create mode 100644 screenhandler/test/fuzztest/dscreen_handler_fuzzer/BUILD.gn create mode 100644 screenhandler/test/fuzztest/dscreen_handler_fuzzer/corpus/init create mode 100644 screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.cpp create mode 100644 screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.h create mode 100644 screenhandler/test/fuzztest/dscreen_handler_fuzzer/project.xml diff --git a/bundle.json b/bundle.json index 1c71c17f..3250cc91 100644 --- a/bundle.json +++ b/bundle.json @@ -79,7 +79,9 @@ "test":[ "//foundation/distributedhardware/distributedscreen/services/screentransport/test/unittest:screen_transport_test", "//foundation/distributedhardware/distributedscreen/services/softbusadapter/test/unittest:SoftBusAdapterTest", - "//foundation/distributedhardware/distributedscreen/services/common/test/unittest:service_common_test" + "//foundation/distributedhardware/distributedscreen/services/common/test/unittest:service_common_test", + "//foundation/distributedhardware/distributedscreen/screenhandler/test/fuzztest:fuzztest", + "//foundation/distributedhardware/distributedscreen/interfaces/innerkits/native_cpp/test/fuzztest:fuzztest" ] } } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/BUILD.gn new file mode 100644 index 00000000..f2fd4c1c --- /dev/null +++ b/interfaces/innerkits/native_cpp/test/fuzztest/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +group("fuzztest") { + testonly = true + + deps = [ + "dscreen_sink_handler_fuzzer:fuzztest", + "dscreen_sink_proxy_fuzzer:fuzztest", + "dscreen_source_handler_fuzzer:fuzztest", + ] +} diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/BUILD.gn new file mode 100644 index 00000000..e22cd1f2 --- /dev/null +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/BUILD.gn @@ -0,0 +1,72 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +#####################hydra-fuzz################### +import("//build/config/features.gni") +import("//build/test.gni") +import( + "//foundation/distributedhardware/distributedscreen/distributedscreen.gni") +##############################fuzztest########################################## +ohos_fuzztest("DscreenSinkHandlerFuzzTest") { + module_out_path = "distributed_screen/dscreen_sink_handler_fuzzer" + + fuzz_config_file = + "${interfaces_path}/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer" + + include_dirs = [ + "//utils/system/safwk/native/include", + "${fwk_common_path}/utils/include", + ] + + include_dirs += [ + "include", + "${common_path}/include", + "${interfaces_path}/innerkits/native_cpp/screen_sink/include", + ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + + sources = [ + "dscreen_sink_handler_fuzzer.cpp", + ] + + deps = [ + "//utils/native/base:utils", + "${common_path}:distributed_screen_utils", + "${interfaces_path}/innerkits/native_cpp/screen_sink:distributed_screen_sink_sdk", + ] + + defines = [ + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"DscreenSinkHandlerFuzzTest\"", + "LOG_DOMAIN=0xD004100", + ] + + external_deps = [ + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr_standard:samgr_proxy", + ] +} +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":DscreenSinkHandlerFuzzTest" ] +} +############################################################################### diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/corpus/init b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/corpus/init new file mode 100644 index 00000000..bc977bd9 --- /dev/null +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +FUZZ \ No newline at end of file diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.cpp new file mode 100644 index 00000000..9b6b6b9c --- /dev/null +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 "dscreen_sink_handler_fuzzer.h" + +#include +#include + +#include "dscreen_constants.h" +#include "dscreen_sink_handler.h" +#include "if_system_ability_manager.h" +#include "iservice_registry.h" + +namespace OHOS { +namespace DistributedHardware { + +void DscreenSinkHandlerFuzzTest(const uint8_t* data, size_t size) +{ + if ((data == nullptr) || (size <= 0)) { + return; + } + + std::string params(reinterpret_cast(data), size); + std::string dhId(reinterpret_cast(data), size); + std::string param(reinterpret_cast(data), size); + + sptr samgr = + SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID); + wptr remote (remoteObject); + DScreenSinkHandler::GetInstance().InitSink(params); + DScreenSinkHandler::GetInstance().SubscribeLocalHardware(dhId, param); + DScreenSinkHandler::GetInstance().UnsubscribeLocalHardware(dhId); + DScreenSinkHandler::GetInstance().ReleaseSink(); + DScreenSinkHandler::GetInstance().OnRemoteSinkSvrDied(remote); +} +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::DistributedHardware::DscreenSinkHandlerFuzzTest(data, size); + return 0; +} + diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.h b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.h new file mode 100644 index 00000000..8a72a851 --- /dev/null +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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. + */ + +#ifndef DSCREEN_SINK_HANDLER_FUZZER_H +#define DSCREEN_SINK_HANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "dscreen_sink_handler_fuzzer" + +#endif + + + diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/project.xml b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/project.xml new file mode 100644 index 00000000..6e8ad2cf --- /dev/null +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/BUILD.gn new file mode 100644 index 00000000..ade73d94 --- /dev/null +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/BUILD.gn @@ -0,0 +1,72 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +#####################hydra-fuzz################### +import("//build/config/features.gni") +import("//build/test.gni") +import( + "//foundation/distributedhardware/distributedscreen/distributedscreen.gni") +##############################fuzztest########################################## +ohos_fuzztest("DscreenSinkProxyFuzzTest") { + module_out_path = "distributed_screen/dscreen_sink_proxy_fuzzer" + + fuzz_config_file = + "${interfaces_path}/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer" + + include_dirs = [ + "//utils/system/safwk/native/include", + "${fwk_common_path}/utils/include", + ] + + include_dirs += [ + "include", + "${common_path}/include", + "${interfaces_path}/innerkits/native_cpp/screen_sink/include", + ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + + sources = [ + "dscreen_sink_proxy_fuzzer.cpp", + ] + + deps = [ + "//utils/native/base:utils", + "${common_path}:distributed_screen_utils", + "${interfaces_path}/innerkits/native_cpp/screen_sink:distributed_screen_sink_sdk", + ] + + defines = [ + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"DscreenSinkProxyFuzzTest\"", + "LOG_DOMAIN=0xD004100", + ] + + external_deps = [ + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr_standard:samgr_proxy", + ] +} +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":DscreenSinkProxyFuzzTest" ] +} +############################################################################### diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/corpus/init b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/corpus/init new file mode 100644 index 00000000..bc977bd9 --- /dev/null +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +FUZZ \ No newline at end of file diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.cpp new file mode 100644 index 00000000..192204b5 --- /dev/null +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 "dscreen_sink_proxy_fuzzer.h" + +#include +#include + +#include "dscreen_constants.h" +#include "dscreen_sink_proxy.h" +#include "if_system_ability_manager.h" +#include "iservice_registry.h" + +namespace OHOS { +namespace DistributedHardware { + +void DscreenSinkProxyHandlerFuzzTest(const uint8_t* data, size_t size) +{ + if ((data == nullptr) || (size <= sizeof(int32_t))) { + return; + } + + std::string params(reinterpret_cast(data), size); + std::string dhId(reinterpret_cast(data), size); + std::string param(reinterpret_cast(data), size); + std::string devId(reinterpret_cast(data), size); + int32_t eventCode = *(reinterpret_cast(data)); + std::string eventContent(reinterpret_cast(data), size); + + sptr samgr = + SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID); + std::shared_ptr dscreenSinkProxy = std::make_shared(remoteObject); + + dscreenSinkProxy->DScreenNotify(devId, eventCode, eventContent); + dscreenSinkProxy->InitSink(params); + dscreenSinkProxy->SubscribeLocalHardware(dhId, param); + dscreenSinkProxy->UnsubscribeLocalHardware(dhId); + dscreenSinkProxy->ReleaseSink(); +} +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::DistributedHardware::DscreenSinkProxyHandlerFuzzTest(data, size); + return 0; +} + diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.h b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.h new file mode 100644 index 00000000..5bcc33c6 --- /dev/null +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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. + */ + +#ifndef DCREEN_SINK_PROXY_FUZZER_H +#define DCREEN_SINK_PROXY_FUZZER_H + +#define FUZZ_PROJECT_NAME "dscreen_sink_proxy_fuzzer" + +#endif + diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/project.xml b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/project.xml new file mode 100644 index 00000000..6e8ad2cf --- /dev/null +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/BUILD.gn new file mode 100644 index 00000000..15b7c393 --- /dev/null +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/BUILD.gn @@ -0,0 +1,77 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +#####################hydra-fuzz################### +import("//build/config/features.gni") +import("//build/test.gni") +import( + "//foundation/distributedhardware/distributedscreen/distributedscreen.gni") +##############################fuzztest########################################## +ohos_fuzztest("DscreenSourceHandlerFuzzTest") { + module_out_path = "distributed_screen/dscreen_source_handler_fuzzer" + + fuzz_config_file = + "${interfaces_path}/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer" + + include_dirs = [ + "//utils/system/safwk/native/include", + "${fwk_common_path}/utils/include", + ] + + include_dirs += [ + "include", + "include/callback", + "${common_path}/include", + "${interfaces_path}/innerkits/native_cpp/screen_source/include", + "${interfaces_path}/innerkits/native_cpp/screen_source/include/callback", + "${fwk_services_path}/distributedhardwarefwkserviceimpl/include", + "${fwk_services_path}/distributedhardwarefwkserviceimpl/include/componentmanager", + ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + + sources = [ + "dscreen_source_handler_fuzzer.cpp", + ] + + deps = [ + "//utils/native/base:utils", + "${common_path}:distributed_screen_utils", + "${interfaces_path}/innerkits/native_cpp/screen_source:distributed_screen_source_sdk", + "${fwk_services_path}/distributedhardwarefwkserviceimpl:distributedhardwarefwksvr_impl", + ] + + defines = [ + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"DscreenSourceHandlerFuzzTest\"", + "LOG_DOMAIN=0xD004100", + ] + + external_deps = [ + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr_standard:samgr_proxy", + ] +} +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":DscreenSourceHandlerFuzzTest" ] +} +############################################################################### diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/corpus/init b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/corpus/init new file mode 100644 index 00000000..bc977bd9 --- /dev/null +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +FUZZ \ No newline at end of file diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.cpp new file mode 100644 index 00000000..c6a8a250 --- /dev/null +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 "dscreen_source_handler_fuzzer.h" + +#include +#include + +#include "component_disable.h" +#include "component_enable.h" +#include "dscreen_constants.h" +#include "dscreen_source_handler.h" +#include "if_system_ability_manager.h" +#include "iservice_registry.h" + +namespace OHOS { +namespace DistributedHardware { + +void DscreenSourceHandlerFuzzTest(const uint8_t* data, size_t size) +{ + if ((data == nullptr) || (size <= 0)) { + return; + } + + std::string params(reinterpret_cast(data), size); + std::string devId(reinterpret_cast(data), size); + std::string dhId(reinterpret_cast(data), size); + std::string key(reinterpret_cast(data), size); + std::string value(reinterpret_cast(data), size); + std::string str(reinterpret_cast(data), size); + EnableParam param; + param.version = str; + param.attrs = str; + std::shared_ptr callback = std::make_shared(); + std::shared_ptr uncallback = std::make_shared(); + + sptr samgr = + SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID); + wptr remote (remoteObject); + + DScreenSourceHandler::GetInstance().InitSource(params); + DScreenSourceHandler::GetInstance().RegisterDistributedHardware(devId, dhId, param, callback); + DScreenSourceHandler::GetInstance().ConfigDistributedHardware(devId, dhId, key, value); + DScreenSourceHandler::GetInstance().UnregisterDistributedHardware(devId, dhId, uncallback); + DScreenSourceHandler::GetInstance().ReleaseSource(); + DScreenSourceHandler::GetInstance().OnRemoteSourceSvrDied(remote); +} +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::DistributedHardware::DscreenSourceHandlerFuzzTest(data, size); + return 0; +} + diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.h b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.h new file mode 100644 index 00000000..342b16b9 --- /dev/null +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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. + */ + +#ifndef DSCREEN_SOURCE_HANDLER_FUZZER_H +#define DSCREEN_SOURCE_HANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "dscreen_source_handler_fuzzer" + +#endif + + + diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/project.xml b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/project.xml new file mode 100644 index 00000000..6e8ad2cf --- /dev/null +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/screenhandler/test/fuzztest/BUILD.gn b/screenhandler/test/fuzztest/BUILD.gn new file mode 100644 index 00000000..5766a68a --- /dev/null +++ b/screenhandler/test/fuzztest/BUILD.gn @@ -0,0 +1,20 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +group("fuzztest") { + testonly = true + + deps = [ + "dscreen_handler_fuzzer:fuzztest", + ] +} \ No newline at end of file diff --git a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/BUILD.gn b/screenhandler/test/fuzztest/dscreen_handler_fuzzer/BUILD.gn new file mode 100644 index 00000000..66f5b8ca --- /dev/null +++ b/screenhandler/test/fuzztest/dscreen_handler_fuzzer/BUILD.gn @@ -0,0 +1,80 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +#####################hydra-fuzz################### +import("//build/config/features.gni") +import("//build/test.gni") +import( + "//foundation/distributedhardware/distributedscreen/distributedscreen.gni") +##############################fuzztest########################################## +ohos_fuzztest("DscreenHandlerFuzzTest") { + module_out_path = "distributed_screen/dscreen_handler_fuzzer" + + fuzz_config_file = + "${distributedscreen_path}/screenhandler/test/fuzztest/dscreen_handler_fuzzer" + + include_dirs = [ + "//third_party/json/include", + "${windowmanager_path}/interfaces/innerkits/dm", + "${mediastandard_path}/interfaces/innerkits/native/media/include", + "${fwk_common_path}/utils/include", + ] + + include_dirs += [ + "include", + "${common_path}/include", + "${distributedscreen_path}/screenhandler/include", + "${fwk_services_path}/distributedhardwarefwkserviceimpl/include/localhardwaremanager", + "//foundation/distributedhardware/distributedhardwarefwk/common/utils/include" + ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + + sources = [ + "dscreen_handler_fuzzer.cpp", + ] + + deps = [ + "//utils/native/base:utils", + "${mediastandard_path}/interfaces/inner_api/native:media_client", + "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", + "//foundation/graphic/standard/rosen/modules/render_service_client:librender_service_client", + "${windowmanager_path}/dm:libdm", + "${common_path}:distributed_screen_utils", + "${distributedscreen_path}/screenhandler:distributed_screen_handler", + "${fwk_services_path}/distributedhardwarefwkserviceimpl:distributedhardwarefwksvr_impl", + ] + + defines = [ + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"DscreenHandlerFuzzTest\"", + "LOG_DOMAIN=0xD004100", + ] + + external_deps = [ + "hiviewdfx_hilog_native:libhilog", + ] + +} +############################################################################### +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":DscreenHandlerFuzzTest" ] +} +############################################################################### diff --git a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/corpus/init b/screenhandler/test/fuzztest/dscreen_handler_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/screenhandler/test/fuzztest/dscreen_handler_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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. + */ + +FUZZ \ No newline at end of file diff --git a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.cpp b/screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.cpp new file mode 100644 index 00000000..5f4dd2d5 --- /dev/null +++ b/screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 "dscreen_handler_fuzzer.h" + +#include +#include +#include + +#include "dscreen_handler.h" +#include "device_type.h" +#include "ihardware_handler.h" +#include "local_hardware_manager.h" +#include "plugin_listener_impl.h" + +namespace OHOS { +namespace DistributedHardware { + +void DscreenHandlerFuzzTest(const uint8_t* data, size_t size) +{ + if ((data == nullptr) || (size <= 0)) { + return; + } + + DHType dhType = DHType::DISPLAY; + std::shared_ptr listener = std::make_shared(dhType); + std::string dhId(reinterpret_cast(data), size); + std::string attr(reinterpret_cast(data), size); + + DScreenHandler::GetInstance().Initialize(); + DScreenHandler::GetInstance().Query(); + DScreenHandler::GetInstance().QueryExtraInfo(); + DScreenHandler::GetInstance().IsSupportPlugin(); + DScreenHandler::GetInstance().RegisterPluginListener(listener); + DScreenHandler::GetInstance().PluginHardware(dhId, attr); + DScreenHandler::GetInstance().UnPluginHardware(dhId); + DScreenHandler::GetInstance().UnRegisterPluginListener(); + DScreenHandler::GetInstance().QueryCodecInfo(); +} +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::DistributedHardware::DscreenHandlerFuzzTest(data, size); + return 0; +} + diff --git a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.h b/screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.h new file mode 100644 index 00000000..e2a9765d --- /dev/null +++ b/screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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. + */ + +#ifndef DSCREEN_HANDLER_FUZZER_H +#define DSCREEN_HANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "dscreen_handler_fuzzer" + +#endif + + diff --git a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/project.xml b/screenhandler/test/fuzztest/dscreen_handler_fuzzer/project.xml new file mode 100644 index 00000000..6e8ad2cf --- /dev/null +++ b/screenhandler/test/fuzztest/dscreen_handler_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + -- Gitee From 2fb475d45a99ae97f77ded54e0713714050c516a Mon Sep 17 00:00:00 2001 From: qinlong0101 Date: Thu, 14 Apr 2022 16:48:38 +0800 Subject: [PATCH 2/5] add screen fuzztest Signed-off-by: qinlong0101 --- .../dscreen_sink_handler_fuzzer/BUILD.gn | 39 +++++++++---------- .../dscreen_sink_handler_fuzzer.h | 5 +-- .../dscreen_sink_proxy_fuzzer.h | 3 +- .../dscreen_source_handler_fuzzer.cpp | 3 +- .../dscreen_source_handler_fuzzer.h | 5 +-- .../dscreen_handler_fuzzer.h | 4 +- 6 files changed, 24 insertions(+), 35 deletions(-) diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/BUILD.gn index e22cd1f2..dcfb6e44 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/BUILD.gn @@ -16,22 +16,22 @@ import("//build/config/features.gni") import("//build/test.gni") import( "//foundation/distributedhardware/distributedscreen/distributedscreen.gni") + ##############################fuzztest########################################## ohos_fuzztest("DscreenSinkHandlerFuzzTest") { module_out_path = "distributed_screen/dscreen_sink_handler_fuzzer" - fuzz_config_file = - "${interfaces_path}/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer" + fuzz_config_file = "${interfaces_path}/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer" include_dirs = [ - "//utils/system/safwk/native/include", - "${fwk_common_path}/utils/include", + "//utils/system/safwk/native/include", + "${fwk_common_path}/utils/include", ] include_dirs += [ - "include", - "${common_path}/include", - "${interfaces_path}/innerkits/native_cpp/screen_sink/include", + "include", + "${common_path}/include", + "${interfaces_path}/innerkits/native_cpp/screen_sink/include", ] cflags = [ @@ -41,29 +41,28 @@ ohos_fuzztest("DscreenSinkHandlerFuzzTest") { "-fno-omit-frame-pointer", ] - sources = [ - "dscreen_sink_handler_fuzzer.cpp", - ] + sources = [ "dscreen_sink_handler_fuzzer.cpp" ] deps = [ - "//utils/native/base:utils", - "${common_path}:distributed_screen_utils", - "${interfaces_path}/innerkits/native_cpp/screen_sink:distributed_screen_sink_sdk", + "${common_path}:distributed_screen_utils", + "${interfaces_path}/innerkits/native_cpp/screen_sink:distributed_screen_sink_sdk", + "//utils/native/base:utils", ] defines = [ - "HI_LOG_ENABLE", - "DH_LOG_TAG=\"DscreenSinkHandlerFuzzTest\"", - "LOG_DOMAIN=0xD004100", + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"DscreenSinkHandlerFuzzTest\"", + "LOG_DOMAIN=0xD004100", ] external_deps = [ - "hiviewdfx_hilog_native:libhilog", - "ipc:ipc_core", - "safwk:system_ability_fwk", - "samgr_standard:samgr_proxy", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr_standard:samgr_proxy", ] } + ############################################################################### group("fuzztest") { testonly = true diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.h b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.h index 8a72a851..2d109e76 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.h +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.h @@ -18,7 +18,4 @@ #define FUZZ_PROJECT_NAME "dscreen_sink_handler_fuzzer" -#endif - - - +#endif \ No newline at end of file diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.h b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.h index 5bcc33c6..f6b47fd0 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.h +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.h @@ -18,5 +18,4 @@ #define FUZZ_PROJECT_NAME "dscreen_sink_proxy_fuzzer" -#endif - +#endif \ No newline at end of file diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.cpp index c6a8a250..9db77dd5 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.cpp +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.cpp @@ -67,5 +67,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) /* Run your code on data */ OHOS::DistributedHardware::DscreenSourceHandlerFuzzTest(data, size); return 0; -} - +} \ No newline at end of file diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.h b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.h index 342b16b9..60ea1677 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.h +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.h @@ -18,7 +18,4 @@ #define FUZZ_PROJECT_NAME "dscreen_source_handler_fuzzer" -#endif - - - +#endif \ No newline at end of file diff --git a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.h b/screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.h index e2a9765d..7ca6e15b 100644 --- a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.h +++ b/screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.h @@ -18,6 +18,4 @@ #define FUZZ_PROJECT_NAME "dscreen_handler_fuzzer" -#endif - - +#endif \ No newline at end of file -- Gitee From 2a3eab5c470acaf6717a4223825d034a2c959bda Mon Sep 17 00:00:00 2001 From: qinlong0101 Date: Thu, 14 Apr 2022 17:22:10 +0800 Subject: [PATCH 3/5] add screen fuzztest Signed-off-by: qinlong0101 --- .../dscreen_sink_handler_fuzzer.cpp | 1 - .../dscreen_sink_proxy_fuzzer/BUILD.gn | 39 +++++++-------- .../dscreen_sink_proxy_fuzzer.cpp | 1 - .../dscreen_source_handler_fuzzer/BUILD.gn | 49 +++++++++---------- .../dscreen_source_handler_fuzzer.cpp | 3 +- .../dscreen_handler_fuzzer.cpp | 1 - 6 files changed, 44 insertions(+), 50 deletions(-) diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.cpp index 9b6b6b9c..66853e0d 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.cpp +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.cpp @@ -25,7 +25,6 @@ namespace OHOS { namespace DistributedHardware { - void DscreenSinkHandlerFuzzTest(const uint8_t* data, size_t size) { if ((data == nullptr) || (size <= 0)) { diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/BUILD.gn index ade73d94..bc4ed68b 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/BUILD.gn @@ -16,22 +16,22 @@ import("//build/config/features.gni") import("//build/test.gni") import( "//foundation/distributedhardware/distributedscreen/distributedscreen.gni") + ##############################fuzztest########################################## ohos_fuzztest("DscreenSinkProxyFuzzTest") { module_out_path = "distributed_screen/dscreen_sink_proxy_fuzzer" - fuzz_config_file = - "${interfaces_path}/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer" + fuzz_config_file = "${interfaces_path}/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer" include_dirs = [ - "//utils/system/safwk/native/include", - "${fwk_common_path}/utils/include", + "//utils/system/safwk/native/include", + "${fwk_common_path}/utils/include", ] include_dirs += [ - "include", - "${common_path}/include", - "${interfaces_path}/innerkits/native_cpp/screen_sink/include", + "include", + "${common_path}/include", + "${interfaces_path}/innerkits/native_cpp/screen_sink/include", ] cflags = [ @@ -41,29 +41,28 @@ ohos_fuzztest("DscreenSinkProxyFuzzTest") { "-fno-omit-frame-pointer", ] - sources = [ - "dscreen_sink_proxy_fuzzer.cpp", - ] + sources = [ "dscreen_sink_proxy_fuzzer.cpp" ] deps = [ - "//utils/native/base:utils", - "${common_path}:distributed_screen_utils", - "${interfaces_path}/innerkits/native_cpp/screen_sink:distributed_screen_sink_sdk", + "${common_path}:distributed_screen_utils", + "${interfaces_path}/innerkits/native_cpp/screen_sink:distributed_screen_sink_sdk", + "//utils/native/base:utils", ] defines = [ - "HI_LOG_ENABLE", - "DH_LOG_TAG=\"DscreenSinkProxyFuzzTest\"", - "LOG_DOMAIN=0xD004100", + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"DscreenSinkProxyFuzzTest\"", + "LOG_DOMAIN=0xD004100", ] external_deps = [ - "hiviewdfx_hilog_native:libhilog", - "ipc:ipc_core", - "safwk:system_ability_fwk", - "samgr_standard:samgr_proxy", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr_standard:samgr_proxy", ] } + ############################################################################### group("fuzztest") { testonly = true diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.cpp index 192204b5..2852d900 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.cpp +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.cpp @@ -25,7 +25,6 @@ namespace OHOS { namespace DistributedHardware { - void DscreenSinkProxyHandlerFuzzTest(const uint8_t* data, size_t size) { if ((data == nullptr) || (size <= sizeof(int32_t))) { diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/BUILD.gn index 15b7c393..188b7de9 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/BUILD.gn @@ -16,26 +16,26 @@ import("//build/config/features.gni") import("//build/test.gni") import( "//foundation/distributedhardware/distributedscreen/distributedscreen.gni") + ##############################fuzztest########################################## ohos_fuzztest("DscreenSourceHandlerFuzzTest") { module_out_path = "distributed_screen/dscreen_source_handler_fuzzer" - fuzz_config_file = - "${interfaces_path}/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer" + fuzz_config_file = "${interfaces_path}/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer" include_dirs = [ - "//utils/system/safwk/native/include", - "${fwk_common_path}/utils/include", + "//utils/system/safwk/native/include", + "${fwk_common_path}/utils/include", ] include_dirs += [ - "include", - "include/callback", - "${common_path}/include", - "${interfaces_path}/innerkits/native_cpp/screen_source/include", - "${interfaces_path}/innerkits/native_cpp/screen_source/include/callback", - "${fwk_services_path}/distributedhardwarefwkserviceimpl/include", - "${fwk_services_path}/distributedhardwarefwkserviceimpl/include/componentmanager", + "include", + "include/callback", + "${common_path}/include", + "${interfaces_path}/innerkits/native_cpp/screen_source/include", + "${interfaces_path}/innerkits/native_cpp/screen_source/include/callback", + "${fwk_services_path}/distributedhardwarefwkserviceimpl/include", + "${fwk_services_path}/distributedhardwarefwkserviceimpl/include/componentmanager", ] cflags = [ @@ -45,30 +45,29 @@ ohos_fuzztest("DscreenSourceHandlerFuzzTest") { "-fno-omit-frame-pointer", ] - sources = [ - "dscreen_source_handler_fuzzer.cpp", - ] + sources = [ "dscreen_source_handler_fuzzer.cpp" ] deps = [ - "//utils/native/base:utils", - "${common_path}:distributed_screen_utils", - "${interfaces_path}/innerkits/native_cpp/screen_source:distributed_screen_source_sdk", - "${fwk_services_path}/distributedhardwarefwkserviceimpl:distributedhardwarefwksvr_impl", + "${common_path}:distributed_screen_utils", + "${fwk_services_path}/distributedhardwarefwkserviceimpl:distributedhardwarefwksvr_impl", + "${interfaces_path}/innerkits/native_cpp/screen_source:distributed_screen_source_sdk", + "//utils/native/base:utils", ] defines = [ - "HI_LOG_ENABLE", - "DH_LOG_TAG=\"DscreenSourceHandlerFuzzTest\"", - "LOG_DOMAIN=0xD004100", + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"DscreenSourceHandlerFuzzTest\"", + "LOG_DOMAIN=0xD004100", ] external_deps = [ - "hiviewdfx_hilog_native:libhilog", - "ipc:ipc_core", - "safwk:system_ability_fwk", - "samgr_standard:samgr_proxy", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr_standard:samgr_proxy", ] } + ############################################################################### group("fuzztest") { testonly = true diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.cpp index 9db77dd5..9bfc6fef 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.cpp +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.cpp @@ -27,7 +27,6 @@ namespace OHOS { namespace DistributedHardware { - void DscreenSourceHandlerFuzzTest(const uint8_t* data, size_t size) { if ((data == nullptr) || (size <= 0)) { @@ -44,7 +43,7 @@ void DscreenSourceHandlerFuzzTest(const uint8_t* data, size_t size) param.version = str; param.attrs = str; std::shared_ptr callback = std::make_shared(); - std::shared_ptr uncallback = std::make_shared(); + std::shared_ptr uncallback = std::make_shared(); sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); diff --git a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.cpp b/screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.cpp index 5f4dd2d5..99120d32 100644 --- a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.cpp +++ b/screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.cpp @@ -27,7 +27,6 @@ namespace OHOS { namespace DistributedHardware { - void DscreenHandlerFuzzTest(const uint8_t* data, size_t size) { if ((data == nullptr) || (size <= 0)) { -- Gitee From 7f8791d51f9611485346592f855fb7a213645478 Mon Sep 17 00:00:00 2001 From: qinlong0101 Date: Thu, 14 Apr 2022 18:23:41 +0800 Subject: [PATCH 4/5] add screen fuzztest Signed-off-by: qinlong0101 --- screenhandler/test/fuzztest/BUILD.gn | 6 +- .../fuzztest/dscreen_handler_fuzzer/BUILD.gn | 56 +++++++++---------- 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/screenhandler/test/fuzztest/BUILD.gn b/screenhandler/test/fuzztest/BUILD.gn index 5766a68a..9869b0d6 100644 --- a/screenhandler/test/fuzztest/BUILD.gn +++ b/screenhandler/test/fuzztest/BUILD.gn @@ -14,7 +14,5 @@ group("fuzztest") { testonly = true - deps = [ - "dscreen_handler_fuzzer:fuzztest", - ] -} \ No newline at end of file + deps = [ "dscreen_handler_fuzzer:fuzztest" ] +} diff --git a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/BUILD.gn b/screenhandler/test/fuzztest/dscreen_handler_fuzzer/BUILD.gn index 66f5b8ca..00bbe067 100644 --- a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/BUILD.gn +++ b/screenhandler/test/fuzztest/dscreen_handler_fuzzer/BUILD.gn @@ -16,26 +16,26 @@ import("//build/config/features.gni") import("//build/test.gni") import( "//foundation/distributedhardware/distributedscreen/distributedscreen.gni") + ##############################fuzztest########################################## ohos_fuzztest("DscreenHandlerFuzzTest") { module_out_path = "distributed_screen/dscreen_handler_fuzzer" - fuzz_config_file = - "${distributedscreen_path}/screenhandler/test/fuzztest/dscreen_handler_fuzzer" + fuzz_config_file = "${distributedscreen_path}/screenhandler/test/fuzztest/dscreen_handler_fuzzer" include_dirs = [ - "//third_party/json/include", - "${windowmanager_path}/interfaces/innerkits/dm", - "${mediastandard_path}/interfaces/innerkits/native/media/include", - "${fwk_common_path}/utils/include", + "//third_party/json/include", + "${windowmanager_path}/interfaces/innerkits/dm", + "${mediastandard_path}/interfaces/innerkits/native/media/include", + "${fwk_common_path}/utils/include", ] include_dirs += [ - "include", - "${common_path}/include", - "${distributedscreen_path}/screenhandler/include", - "${fwk_services_path}/distributedhardwarefwkserviceimpl/include/localhardwaremanager", - "//foundation/distributedhardware/distributedhardwarefwk/common/utils/include" + "include", + "${common_path}/include", + "${distributedscreen_path}/screenhandler/include", + "${fwk_services_path}/distributedhardwarefwkserviceimpl/include/localhardwaremanager", + "//foundation/distributedhardware/distributedhardwarefwk/common/utils/include", ] cflags = [ @@ -43,34 +43,30 @@ ohos_fuzztest("DscreenHandlerFuzzTest") { "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", - ] - - sources = [ - "dscreen_handler_fuzzer.cpp", ] + sources = [ "dscreen_handler_fuzzer.cpp" ] + deps = [ - "//utils/native/base:utils", - "${mediastandard_path}/interfaces/inner_api/native:media_client", - "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", - "//foundation/graphic/standard/rosen/modules/render_service_client:librender_service_client", - "${windowmanager_path}/dm:libdm", - "${common_path}:distributed_screen_utils", - "${distributedscreen_path}/screenhandler:distributed_screen_handler", - "${fwk_services_path}/distributedhardwarefwkserviceimpl:distributedhardwarefwksvr_impl", + "${common_path}:distributed_screen_utils", + "${distributedscreen_path}/screenhandler:distributed_screen_handler", + "${fwk_services_path}/distributedhardwarefwkserviceimpl:distributedhardwarefwksvr_impl", + "${mediastandard_path}/interfaces/inner_api/native:media_client", + "${windowmanager_path}/dm:libdm", + "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", + "//foundation/graphic/standard/rosen/modules/render_service_client:librender_service_client", + "//utils/native/base:utils", ] defines = [ - "HI_LOG_ENABLE", - "DH_LOG_TAG=\"DscreenHandlerFuzzTest\"", - "LOG_DOMAIN=0xD004100", - ] - - external_deps = [ - "hiviewdfx_hilog_native:libhilog", + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"DscreenHandlerFuzzTest\"", + "LOG_DOMAIN=0xD004100", ] + external_deps = [ "hiviewdfx_hilog_native:libhilog" ] } + ############################################################################### group("fuzztest") { testonly = true -- Gitee From 6c4ffa32077e9c2c59889c5231598c3d60aba1a4 Mon Sep 17 00:00:00 2001 From: qinlong0101 Date: Wed, 20 Apr 2022 09:45:01 +0800 Subject: [PATCH 5/5] add screen fuzz test Signed-off-by: qinlong0101 --- interfaces/innerkits/native_cpp/test/fuzztest/BUILD.gn | 6 +++--- .../BUILD.gn | 4 ++-- .../corpus/init | 0 .../dscreen_sink_handler_fuzzer.cpp | 0 .../dscreen_sink_handler_fuzzer.h | 0 .../project.xml | 0 .../BUILD.gn | 4 ++-- .../corpus/init | 0 .../dscreen_sink_proxy_fuzzer.cpp | 0 .../dscreen_sink_proxy_fuzzer.h | 0 .../project.xml | 0 .../BUILD.gn | 4 ++-- .../corpus/init | 0 .../dscreen_source_handler_fuzzer.cpp | 0 .../dscreen_source_handler_fuzzer.h | 0 .../project.xml | 0 screenhandler/test/fuzztest/BUILD.gn | 2 +- .../BUILD.gn | 4 ++-- .../corpus/init | 0 .../dscreen_handler_fuzzer.cpp | 0 .../dscreen_handler_fuzzer.h | 0 .../project.xml | 0 22 files changed, 12 insertions(+), 12 deletions(-) rename interfaces/innerkits/native_cpp/test/fuzztest/{dscreen_sink_handler_fuzzer => dscreensinkhandler_fuzzer}/BUILD.gn (94%) rename interfaces/innerkits/native_cpp/test/fuzztest/{dscreen_sink_handler_fuzzer => dscreensinkhandler_fuzzer}/corpus/init (100%) rename interfaces/innerkits/native_cpp/test/fuzztest/{dscreen_sink_handler_fuzzer => dscreensinkhandler_fuzzer}/dscreen_sink_handler_fuzzer.cpp (100%) rename interfaces/innerkits/native_cpp/test/fuzztest/{dscreen_sink_handler_fuzzer => dscreensinkhandler_fuzzer}/dscreen_sink_handler_fuzzer.h (100%) rename interfaces/innerkits/native_cpp/test/fuzztest/{dscreen_sink_handler_fuzzer => dscreensinkhandler_fuzzer}/project.xml (100%) rename interfaces/innerkits/native_cpp/test/fuzztest/{dscreen_sink_proxy_fuzzer => dscreensinkproxy_fuzzer}/BUILD.gn (95%) rename interfaces/innerkits/native_cpp/test/fuzztest/{dscreen_sink_proxy_fuzzer => dscreensinkproxy_fuzzer}/corpus/init (100%) rename interfaces/innerkits/native_cpp/test/fuzztest/{dscreen_sink_proxy_fuzzer => dscreensinkproxy_fuzzer}/dscreen_sink_proxy_fuzzer.cpp (100%) rename interfaces/innerkits/native_cpp/test/fuzztest/{dscreen_sink_proxy_fuzzer => dscreensinkproxy_fuzzer}/dscreen_sink_proxy_fuzzer.h (100%) rename interfaces/innerkits/native_cpp/test/fuzztest/{dscreen_sink_proxy_fuzzer => dscreensinkproxy_fuzzer}/project.xml (100%) rename interfaces/innerkits/native_cpp/test/fuzztest/{dscreen_source_handler_fuzzer => dscreensourcehandler_fuzzer}/BUILD.gn (95%) rename interfaces/innerkits/native_cpp/test/fuzztest/{dscreen_source_handler_fuzzer => dscreensourcehandler_fuzzer}/corpus/init (100%) rename interfaces/innerkits/native_cpp/test/fuzztest/{dscreen_source_handler_fuzzer => dscreensourcehandler_fuzzer}/dscreen_source_handler_fuzzer.cpp (100%) rename interfaces/innerkits/native_cpp/test/fuzztest/{dscreen_source_handler_fuzzer => dscreensourcehandler_fuzzer}/dscreen_source_handler_fuzzer.h (100%) rename interfaces/innerkits/native_cpp/test/fuzztest/{dscreen_source_handler_fuzzer => dscreensourcehandler_fuzzer}/project.xml (100%) rename screenhandler/test/fuzztest/{dscreen_handler_fuzzer => dscreenhandler_fuzzer}/BUILD.gn (96%) rename screenhandler/test/fuzztest/{dscreen_handler_fuzzer => dscreenhandler_fuzzer}/corpus/init (100%) rename screenhandler/test/fuzztest/{dscreen_handler_fuzzer => dscreenhandler_fuzzer}/dscreen_handler_fuzzer.cpp (100%) rename screenhandler/test/fuzztest/{dscreen_handler_fuzzer => dscreenhandler_fuzzer}/dscreen_handler_fuzzer.h (100%) rename screenhandler/test/fuzztest/{dscreen_handler_fuzzer => dscreenhandler_fuzzer}/project.xml (100%) diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/BUILD.gn index f2fd4c1c..fd6ed3ee 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/BUILD.gn @@ -15,8 +15,8 @@ group("fuzztest") { testonly = true deps = [ - "dscreen_sink_handler_fuzzer:fuzztest", - "dscreen_sink_proxy_fuzzer:fuzztest", - "dscreen_source_handler_fuzzer:fuzztest", + "dscreensinkhandler_fuzzer:fuzztest", + "dscreensinkproxy_fuzzer:fuzztest", + "dscreensourcehandler_fuzzer:fuzztest", ] } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkhandler_fuzzer/BUILD.gn similarity index 94% rename from interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/BUILD.gn rename to interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkhandler_fuzzer/BUILD.gn index dcfb6e44..0d665773 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkhandler_fuzzer/BUILD.gn @@ -19,9 +19,9 @@ import( ##############################fuzztest########################################## ohos_fuzztest("DscreenSinkHandlerFuzzTest") { - module_out_path = "distributed_screen/dscreen_sink_handler_fuzzer" + module_out_path = "distributed_screen/dscreensinkhandler_fuzzer" - fuzz_config_file = "${interfaces_path}/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer" + fuzz_config_file = "${interfaces_path}/innerkits/native_cpp/test/fuzztest/dscreensinkhandler_fuzzer" include_dirs = [ "//utils/system/safwk/native/include", diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/corpus/init b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkhandler_fuzzer/corpus/init similarity index 100% rename from interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/corpus/init rename to interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkhandler_fuzzer/corpus/init diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkhandler_fuzzer/dscreen_sink_handler_fuzzer.cpp similarity index 100% rename from interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.cpp rename to interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkhandler_fuzzer/dscreen_sink_handler_fuzzer.cpp diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.h b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkhandler_fuzzer/dscreen_sink_handler_fuzzer.h similarity index 100% rename from interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/dscreen_sink_handler_fuzzer.h rename to interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkhandler_fuzzer/dscreen_sink_handler_fuzzer.h diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/project.xml b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkhandler_fuzzer/project.xml similarity index 100% rename from interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler_fuzzer/project.xml rename to interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkhandler_fuzzer/project.xml diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkproxy_fuzzer/BUILD.gn similarity index 95% rename from interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/BUILD.gn rename to interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkproxy_fuzzer/BUILD.gn index bc4ed68b..3c605425 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkproxy_fuzzer/BUILD.gn @@ -19,9 +19,9 @@ import( ##############################fuzztest########################################## ohos_fuzztest("DscreenSinkProxyFuzzTest") { - module_out_path = "distributed_screen/dscreen_sink_proxy_fuzzer" + module_out_path = "distributed_screen/dscreensinkproxy_fuzzer" - fuzz_config_file = "${interfaces_path}/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer" + fuzz_config_file = "${interfaces_path}/innerkits/native_cpp/test/fuzztest/dscreensinkproxy_fuzzer" include_dirs = [ "//utils/system/safwk/native/include", diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/corpus/init b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkproxy_fuzzer/corpus/init similarity index 100% rename from interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/corpus/init rename to interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkproxy_fuzzer/corpus/init diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkproxy_fuzzer/dscreen_sink_proxy_fuzzer.cpp similarity index 100% rename from interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.cpp rename to interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkproxy_fuzzer/dscreen_sink_proxy_fuzzer.cpp diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.h b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkproxy_fuzzer/dscreen_sink_proxy_fuzzer.h similarity index 100% rename from interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/dscreen_sink_proxy_fuzzer.h rename to interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkproxy_fuzzer/dscreen_sink_proxy_fuzzer.h diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/project.xml b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkproxy_fuzzer/project.xml similarity index 100% rename from interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy_fuzzer/project.xml rename to interfaces/innerkits/native_cpp/test/fuzztest/dscreensinkproxy_fuzzer/project.xml diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensourcehandler_fuzzer/BUILD.gn similarity index 95% rename from interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/BUILD.gn rename to interfaces/innerkits/native_cpp/test/fuzztest/dscreensourcehandler_fuzzer/BUILD.gn index 188b7de9..12514222 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensourcehandler_fuzzer/BUILD.gn @@ -19,9 +19,9 @@ import( ##############################fuzztest########################################## ohos_fuzztest("DscreenSourceHandlerFuzzTest") { - module_out_path = "distributed_screen/dscreen_source_handler_fuzzer" + module_out_path = "distributed_screen/dscreensourcehandler_fuzzer" - fuzz_config_file = "${interfaces_path}/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer" + fuzz_config_file = "${interfaces_path}/innerkits/native_cpp/test/fuzztest/dscreensourcehandler_fuzzer" include_dirs = [ "//utils/system/safwk/native/include", diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/corpus/init b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensourcehandler_fuzzer/corpus/init similarity index 100% rename from interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/corpus/init rename to interfaces/innerkits/native_cpp/test/fuzztest/dscreensourcehandler_fuzzer/corpus/init diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensourcehandler_fuzzer/dscreen_source_handler_fuzzer.cpp similarity index 100% rename from interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.cpp rename to interfaces/innerkits/native_cpp/test/fuzztest/dscreensourcehandler_fuzzer/dscreen_source_handler_fuzzer.cpp diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.h b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensourcehandler_fuzzer/dscreen_source_handler_fuzzer.h similarity index 100% rename from interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/dscreen_source_handler_fuzzer.h rename to interfaces/innerkits/native_cpp/test/fuzztest/dscreensourcehandler_fuzzer/dscreen_source_handler_fuzzer.h diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/project.xml b/interfaces/innerkits/native_cpp/test/fuzztest/dscreensourcehandler_fuzzer/project.xml similarity index 100% rename from interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler_fuzzer/project.xml rename to interfaces/innerkits/native_cpp/test/fuzztest/dscreensourcehandler_fuzzer/project.xml diff --git a/screenhandler/test/fuzztest/BUILD.gn b/screenhandler/test/fuzztest/BUILD.gn index 9869b0d6..9c99a47e 100644 --- a/screenhandler/test/fuzztest/BUILD.gn +++ b/screenhandler/test/fuzztest/BUILD.gn @@ -14,5 +14,5 @@ group("fuzztest") { testonly = true - deps = [ "dscreen_handler_fuzzer:fuzztest" ] + deps = [ "dscreenhandler_fuzzer:fuzztest" ] } diff --git a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/BUILD.gn b/screenhandler/test/fuzztest/dscreenhandler_fuzzer/BUILD.gn similarity index 96% rename from screenhandler/test/fuzztest/dscreen_handler_fuzzer/BUILD.gn rename to screenhandler/test/fuzztest/dscreenhandler_fuzzer/BUILD.gn index 00bbe067..a97ffede 100644 --- a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/BUILD.gn +++ b/screenhandler/test/fuzztest/dscreenhandler_fuzzer/BUILD.gn @@ -19,9 +19,9 @@ import( ##############################fuzztest########################################## ohos_fuzztest("DscreenHandlerFuzzTest") { - module_out_path = "distributed_screen/dscreen_handler_fuzzer" + module_out_path = "distributed_screen/dscreenhandler_fuzzer" - fuzz_config_file = "${distributedscreen_path}/screenhandler/test/fuzztest/dscreen_handler_fuzzer" + fuzz_config_file = "${distributedscreen_path}/screenhandler/test/fuzztest/dscreenhandler_fuzzer" include_dirs = [ "//third_party/json/include", diff --git a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/corpus/init b/screenhandler/test/fuzztest/dscreenhandler_fuzzer/corpus/init similarity index 100% rename from screenhandler/test/fuzztest/dscreen_handler_fuzzer/corpus/init rename to screenhandler/test/fuzztest/dscreenhandler_fuzzer/corpus/init diff --git a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.cpp b/screenhandler/test/fuzztest/dscreenhandler_fuzzer/dscreen_handler_fuzzer.cpp similarity index 100% rename from screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.cpp rename to screenhandler/test/fuzztest/dscreenhandler_fuzzer/dscreen_handler_fuzzer.cpp diff --git a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.h b/screenhandler/test/fuzztest/dscreenhandler_fuzzer/dscreen_handler_fuzzer.h similarity index 100% rename from screenhandler/test/fuzztest/dscreen_handler_fuzzer/dscreen_handler_fuzzer.h rename to screenhandler/test/fuzztest/dscreenhandler_fuzzer/dscreen_handler_fuzzer.h diff --git a/screenhandler/test/fuzztest/dscreen_handler_fuzzer/project.xml b/screenhandler/test/fuzztest/dscreenhandler_fuzzer/project.xml similarity index 100% rename from screenhandler/test/fuzztest/dscreen_handler_fuzzer/project.xml rename to screenhandler/test/fuzztest/dscreenhandler_fuzzer/project.xml -- Gitee