From d71a2609e62f1cbd4beabd6f2047f0b0bb2b0497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=9B=B7?= Date: Tue, 15 Jul 2025 10:46:08 +0800 Subject: [PATCH] modify fuzz MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张雷 --- test/commonfuzztest/dmanonyous_fuzzer/dm_anonyous_fuzzer.cpp | 5 ++--- .../dm_negotiate_process_fuzzer.cpp | 5 ++--- .../dmtransport_fuzzer/dm_transport_fuzzer.cpp | 5 ++--- .../dpinitcallback_fuzzer/dp_init_callback_fuzzer.cpp | 5 ++--- .../ipccmdregister_fuzzer/ipc_cmd_register_fuzzer.cpp | 5 ++--- .../ipc_server_client_proxy_fuzzer.cpp | 5 ++--- .../ipcserverlistener_fuzzer/ipc_server_listener_fuzzer.cpp | 5 ++--- .../onbytesreceived_fuzzer/on_bytes_received_fuzzer.cpp | 5 ++--- .../on_softbus_device_offline_fuzzer.cpp | 5 ++--- .../on_softbus_device_online_fuzzer.cpp | 5 ++--- .../softbus_session_object_fuzzer.cpp | 5 ++--- 11 files changed, 22 insertions(+), 33 deletions(-) diff --git a/test/commonfuzztest/dmanonyous_fuzzer/dm_anonyous_fuzzer.cpp b/test/commonfuzztest/dmanonyous_fuzzer/dm_anonyous_fuzzer.cpp index dafa558a4..820c1a2c1 100644 --- a/test/commonfuzztest/dmanonyous_fuzzer/dm_anonyous_fuzzer.cpp +++ b/test/commonfuzztest/dmanonyous_fuzzer/dm_anonyous_fuzzer.cpp @@ -26,9 +26,8 @@ namespace DistributedHardware { void DmAnonyousFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size < sizeof(int32_t))) { - return; - } + (void)data; + (void)size; std::vector strList; int64_t testNumber = 123; int64_t decimal = 10; diff --git a/test/commonfuzztest/dmnegotiateprocess_fuzzer/dm_negotiate_process_fuzzer.cpp b/test/commonfuzztest/dmnegotiateprocess_fuzzer/dm_negotiate_process_fuzzer.cpp index 51c8eb047..ae48ed1e0 100644 --- a/test/commonfuzztest/dmnegotiateprocess_fuzzer/dm_negotiate_process_fuzzer.cpp +++ b/test/commonfuzztest/dmnegotiateprocess_fuzzer/dm_negotiate_process_fuzzer.cpp @@ -67,9 +67,8 @@ void GetSinkProxyCredTypeForP2PFuzzTest(const uint8_t* data, size_t size) void DmNegotiateProcessFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size < sizeof(int32_t))) { - return; - } + (void)data; + (void)size; std::shared_ptr context = std::make_shared(); NoCredNoAclImportAuthType noCredNoAclImportAuthType; noCredNoAclImportAuthType.NegotiateHandle(context); diff --git a/test/servicesfuzztest/dmtransport_fuzzer/dm_transport_fuzzer.cpp b/test/servicesfuzztest/dmtransport_fuzzer/dm_transport_fuzzer.cpp index f01ed0edf..8225a865e 100644 --- a/test/servicesfuzztest/dmtransport_fuzzer/dm_transport_fuzzer.cpp +++ b/test/servicesfuzztest/dmtransport_fuzzer/dm_transport_fuzzer.cpp @@ -118,9 +118,8 @@ void DmTransPortFirstFuzzTest(const uint8_t* data, size_t size) void DmTransPortSecondFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size < sizeof(int32_t))) { - return; - } + (void)data; + (void)size; std::shared_ptr dmCommToolPtr = std::make_shared(); std::shared_ptr dmTransPortPtr = std::make_shared(dmCommToolPtr); diff --git a/test/servicesfuzztest/dpinitcallback_fuzzer/dp_init_callback_fuzzer.cpp b/test/servicesfuzztest/dpinitcallback_fuzzer/dp_init_callback_fuzzer.cpp index db548cd8e..4237439c4 100644 --- a/test/servicesfuzztest/dpinitcallback_fuzzer/dp_init_callback_fuzzer.cpp +++ b/test/servicesfuzztest/dpinitcallback_fuzzer/dp_init_callback_fuzzer.cpp @@ -42,9 +42,8 @@ void DpInitedCallbackFuzzTest(const uint8_t* data, size_t size) void DpInitedCallbackFirstFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size < sizeof(int32_t))) { - return; - } + (void)data; + (void)size; DpInitedCallback dpInitedCallback; std::unordered_map authFormMap; DmDeviceInfo deviceInfo; diff --git a/test/servicesfuzztest/ipccmdregister_fuzzer/ipc_cmd_register_fuzzer.cpp b/test/servicesfuzztest/ipccmdregister_fuzzer/ipc_cmd_register_fuzzer.cpp index 99d41ffae..af003c812 100644 --- a/test/servicesfuzztest/ipccmdregister_fuzzer/ipc_cmd_register_fuzzer.cpp +++ b/test/servicesfuzztest/ipccmdregister_fuzzer/ipc_cmd_register_fuzzer.cpp @@ -38,9 +38,8 @@ namespace OHOS { namespace DistributedHardware { void IpcCmdRegisterFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size == 0)) { - return; - } + (void)data; + (void)size; int32_t cmdCode = UNREGISTER_DEVICE_MANAGER_LISTENER; std::shared_ptr req = std::make_shared(); std::shared_ptr rsp = std::make_shared(); diff --git a/test/servicesfuzztest/ipcserverclientproxy_fuzzer/ipc_server_client_proxy_fuzzer.cpp b/test/servicesfuzztest/ipcserverclientproxy_fuzzer/ipc_server_client_proxy_fuzzer.cpp index 6f11a2ea2..774777f6e 100644 --- a/test/servicesfuzztest/ipcserverclientproxy_fuzzer/ipc_server_client_proxy_fuzzer.cpp +++ b/test/servicesfuzztest/ipcserverclientproxy_fuzzer/ipc_server_client_proxy_fuzzer.cpp @@ -28,9 +28,8 @@ namespace OHOS { namespace DistributedHardware { void IpcServerClientProxyFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size == 0)) { - return; - } + (void)data; + (void)size; int32_t cmdCode = UNREGISTER_DEVICE_MANAGER_LISTENER; std::shared_ptr req = std::make_shared(); diff --git a/test/servicesfuzztest/ipcserverlistener_fuzzer/ipc_server_listener_fuzzer.cpp b/test/servicesfuzztest/ipcserverlistener_fuzzer/ipc_server_listener_fuzzer.cpp index b7c8de713..7a10bc90a 100644 --- a/test/servicesfuzztest/ipcserverlistener_fuzzer/ipc_server_listener_fuzzer.cpp +++ b/test/servicesfuzztest/ipcserverlistener_fuzzer/ipc_server_listener_fuzzer.cpp @@ -28,9 +28,8 @@ namespace OHOS { namespace DistributedHardware { void IpcServerListenerFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size == 0)) { - return; - } + (void)data; + (void)size; int32_t cmdCode = UNREGISTER_DEVICE_MANAGER_LISTENER; std::shared_ptr req = std::make_shared(); std::shared_ptr rsp = std::make_shared(); diff --git a/test/softbusfuzztest/onbytesreceived_fuzzer/on_bytes_received_fuzzer.cpp b/test/softbusfuzztest/onbytesreceived_fuzzer/on_bytes_received_fuzzer.cpp index 2fe1110fd..1aa13bb4b 100644 --- a/test/softbusfuzztest/onbytesreceived_fuzzer/on_bytes_received_fuzzer.cpp +++ b/test/softbusfuzztest/onbytesreceived_fuzzer/on_bytes_received_fuzzer.cpp @@ -54,9 +54,8 @@ public: void OnBytesReceivedFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size < sizeof(int))) { - return; - } + (void)data; + (void)size; std::shared_ptr softbusSession = std::make_shared(); softbusSession->RegisterSessionCallback(std::make_shared()); diff --git a/test/softbusfuzztest/onsoftbusdeviceoffline_fuzzer/on_softbus_device_offline_fuzzer.cpp b/test/softbusfuzztest/onsoftbusdeviceoffline_fuzzer/on_softbus_device_offline_fuzzer.cpp index 0a1036bc8..46b58275e 100644 --- a/test/softbusfuzztest/onsoftbusdeviceoffline_fuzzer/on_softbus_device_offline_fuzzer.cpp +++ b/test/softbusfuzztest/onsoftbusdeviceoffline_fuzzer/on_softbus_device_offline_fuzzer.cpp @@ -26,9 +26,8 @@ namespace OHOS { namespace DistributedHardware { void OnSoftbusDeviceOfflineFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size < sizeof(uint16_t) || (size > DM_MAX_DEVICE_ID_LEN))) { - return; - } + (void)data; + (void)size; std::shared_ptr softbusListener = std::make_shared(); NodeBasicInfo *info = nullptr; diff --git a/test/softbusfuzztest/onsoftbusdeviceonline_fuzzer/on_softbus_device_online_fuzzer.cpp b/test/softbusfuzztest/onsoftbusdeviceonline_fuzzer/on_softbus_device_online_fuzzer.cpp index db02ee986..4efcd1b02 100644 --- a/test/softbusfuzztest/onsoftbusdeviceonline_fuzzer/on_softbus_device_online_fuzzer.cpp +++ b/test/softbusfuzztest/onsoftbusdeviceonline_fuzzer/on_softbus_device_online_fuzzer.cpp @@ -26,9 +26,8 @@ namespace OHOS { namespace DistributedHardware { void OnSoftbusDeviceOnlineFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size < sizeof(uint16_t) || (size > DM_MAX_DEVICE_ID_LEN))) { - return; - } + (void)data; + (void)size; std::shared_ptr softbusListener = std::make_shared(); NodeBasicInfo *info = nullptr; diff --git a/test/softbusfuzztest/softbussessionobject_fuzzer/softbus_session_object_fuzzer.cpp b/test/softbusfuzztest/softbussessionobject_fuzzer/softbus_session_object_fuzzer.cpp index 3d76c29ca..4fe4669e0 100644 --- a/test/softbusfuzztest/softbussessionobject_fuzzer/softbus_session_object_fuzzer.cpp +++ b/test/softbusfuzztest/softbussessionobject_fuzzer/softbus_session_object_fuzzer.cpp @@ -54,9 +54,8 @@ public: void SoftBusSessionFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size < sizeof(int32_t))) { - return; - } + (void)data; + (void)size; std::shared_ptr softbusSession = std::make_shared(); softbusSession->RegisterSessionCallback(std::make_shared()); -- Gitee