From e0cacf2f219cc1895b80f7c555049238fb914a1a Mon Sep 17 00:00:00 2001 From: qinlong Date: Tue, 27 Sep 2022 10:41:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E5=B1=8F=E5=B9=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9FUZZ?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: qinlong --- .../handleronremotesinksvrdied_fuzzer/BUILD.gn | 2 ++ .../onremotesinksvrdied_fuzzer.cpp | 4 ++-- .../proxyinitsink_fuzzer/initsink_fuzzer.cpp | 2 +- .../subscribelocalhardware_fuzzer.cpp | 2 +- .../unsubscribelocalhardware_fuzzer.cpp | 2 +- .../sinkproxydscreennotify_fuzzer.cpp | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) 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 14599431..0dda93f8 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 52a91ac0..6962303e 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 a4890048..df1d4c35 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 c3db6e4c..c0dcb6d4 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 e98d94ee..6d0596f2 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 9d3ecdb3..f33a9c7c 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; } -- Gitee