diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handleronremotesinksvrdied_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handleronremotesinksvrdied_fuzzer/BUILD.gn index 14599431b0589051dec5db1c86ee9d3ca319c6ab..0dda93f8483d4d58bb54d34154ecaea759a35abb 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handleronremotesinksvrdied_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handleronremotesinksvrdied_fuzzer/BUILD.gn @@ -44,6 +44,8 @@ ohos_fuzztest("HandlerOnRemoteSinkSvrDiedFuzzTest") { sources = [ "onremotesinksvrdied_fuzzer.cpp" ] + deps = [ "${interfaces_path}/innerkits/native_cpp/screen_sink:distributed_screen_sink_sdk" ] + defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"HandlerOnRemoteSinkSvrDiedFuzzTest\"", diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handleronremotesinksvrdied_fuzzer/onremotesinksvrdied_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handleronremotesinksvrdied_fuzzer/onremotesinksvrdied_fuzzer.cpp index 52a91ac08d8843b9e0a5cb67b7f204a1df516d9c..6962303ed22ac1fbc5adbd387bfd02728ad1823e 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handleronremotesinksvrdied_fuzzer/onremotesinksvrdied_fuzzer.cpp +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handleronremotesinksvrdied_fuzzer/onremotesinksvrdied_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { namespace DistributedHardware { void OnRemoteSinkSvrDiedFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size <= 0)) { + if ((data == nullptr) || (size < sizeof(int32_t))) { return; } @@ -34,7 +34,7 @@ void OnRemoteSinkSvrDiedFuzzTest(const uint8_t* data, size_t size) sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - if (samgr != nullptr) { + if (samgr == nullptr) { return; } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyinitsink_fuzzer/initsink_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyinitsink_fuzzer/initsink_fuzzer.cpp index a48900484ac6333edadfe56084bfde019bf5a146..df1d4c35ffa31aea2b43e151a3e290b27cf897ba 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyinitsink_fuzzer/initsink_fuzzer.cpp +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyinitsink_fuzzer/initsink_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { namespace DistributedHardware { void InitSinkFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size <= sizeof(int32_t))) { + if ((data == nullptr) || (size <= 0)) { return; } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxysubscribelocalhardware_fuzzer/subscribelocalhardware_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxysubscribelocalhardware_fuzzer/subscribelocalhardware_fuzzer.cpp index c3db6e4c573761672345f4a0c29430ee0221ec6d..c0dcb6d4da46fc5b5a11b6195e4abf4c6f24e15e 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxysubscribelocalhardware_fuzzer/subscribelocalhardware_fuzzer.cpp +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxysubscribelocalhardware_fuzzer/subscribelocalhardware_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { namespace DistributedHardware { void SubscribeLocalHardwareFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size <= sizeof(int32_t))) { + if ((data == nullptr) || (size <= 0)) { return; } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyunsubscribelocalhardware_fuzzer/unsubscribelocalhardware_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyunsubscribelocalhardware_fuzzer/unsubscribelocalhardware_fuzzer.cpp index e98d94ee641e5c7931758604b1412593b7216af6..6d0596f227b98546767c7818070e3c9ac963efd4 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyunsubscribelocalhardware_fuzzer/unsubscribelocalhardware_fuzzer.cpp +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyunsubscribelocalhardware_fuzzer/unsubscribelocalhardware_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { namespace DistributedHardware { void UnsubscribeLocalHardwareFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size <= sizeof(int32_t))) { + if ((data == nullptr) || (size <= 0)) { return; } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/sinkproxydscreennotify_fuzzer/sinkproxydscreennotify_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/sinkproxydscreennotify_fuzzer/sinkproxydscreennotify_fuzzer.cpp index 9d3ecdb36e15189ce7bf5c88dae52760cfa1a062..f33a9c7cdb21c9a07897f5d1e166493cfc656b2f 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/sinkproxydscreennotify_fuzzer/sinkproxydscreennotify_fuzzer.cpp +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/sinkproxydscreennotify_fuzzer/sinkproxydscreennotify_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { namespace DistributedHardware { void DScreenNotifyFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size <= sizeof(int32_t))) { + if ((data == nullptr) || (size < sizeof(int32_t))) { return; }