From ddbe901e3cf4d1af90ad3fa2f93d610d4a05bb3a Mon Sep 17 00:00:00 2001 From: weimengxue Date: Fri, 11 Oct 2024 03:34:46 +0000 Subject: [PATCH] =?UTF-8?q?fix:=E5=B1=8F=E8=94=BD=E9=AB=98=E9=A3=8E?= =?UTF-8?q?=E9=99=A9fuzz=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: weimengxue --- ipc/native/src/napi_common/source/napi_remote_object.cpp | 7 ++++++- ipc/native/test/fuzztest/c/getfeaturesize_fuzzer/BUILD.gn | 2 +- .../test/fuzztest/c/getrpcfeatureack_fuzzer/BUILD.gn | 2 +- .../test/fuzztest/c/gettokenfromdata_fuzzer/BUILD.gn | 2 +- ipc/native/test/fuzztest/c/gettokenidsize_fuzzer/BUILD.gn | 2 +- ipc/native/test/fuzztest/c/isatenable_fuzzer/BUILD.gn | 2 +- ipc/native/test/fuzztest/c/isfeatureack_fuzzer/BUILD.gn | 2 +- .../test/fuzztest/c/setfeaturetransdata_fuzzer/BUILD.gn | 2 +- ipc/native/test/fuzztest/core/bufferobject_fuzzer/BUILD.gn | 2 +- .../test/fuzztest/closedatabussession_fuzzer/BUILD.gn | 2 +- .../dbinder/test/fuzztest/dbinderservice_fuzzer/BUILD.gn | 2 +- .../test/fuzztest/detachproxyobject_fuzzer/BUILD.gn | 2 +- .../fuzztest/loadsystemabilitycomplete_fuzzer/BUILD.gn | 2 +- .../dbinder/test/fuzztest/noticedevicedie_fuzzer/BUILD.gn | 2 +- .../dbinder/test/fuzztest/noticeservicedie_fuzzer/BUILD.gn | 2 +- .../dbinder/test/fuzztest/onbytesreceived_fuzzer/BUILD.gn | 2 +- .../dbinder/test/fuzztest/senddatatoremote_fuzzer/BUILD.gn | 2 +- 17 files changed, 22 insertions(+), 17 deletions(-) diff --git a/ipc/native/src/napi_common/source/napi_remote_object.cpp b/ipc/native/src/napi_common/source/napi_remote_object.cpp index 94c152cd..a24225ac 100644 --- a/ipc/native/src/napi_common/source/napi_remote_object.cpp +++ b/ipc/native/src/napi_common/source/napi_remote_object.cpp @@ -375,7 +375,13 @@ napi_value NAPIRemoteObject::ThenCallback(napi_env env, napi_callback_info info) napi_value argv[ARGV_LENGTH_1] = {nullptr}; void* data = nullptr; napi_get_cb_info(env, info, &argc, argv, nullptr, &data); + napi_value res; CallbackParam *param = static_cast(data); + if (param == nullptr) { + ZLOGE(LOG_LABEL, "param is null"); + napi_get_undefined(env, &res); + return res; + } bool result = false; napi_get_value_bool(param->env, argv[ARGV_INDEX_0], &result); if (!result) { @@ -391,7 +397,6 @@ napi_value NAPIRemoteObject::ThenCallback(napi_env env, napi_callback_info info) std::unique_lock lock(param->lockInfo->mutex); param->lockInfo->ready = true; param->lockInfo->condition.notify_all(); - napi_value res; napi_get_undefined(env, &res); return res; } diff --git a/ipc/native/test/fuzztest/c/getfeaturesize_fuzzer/BUILD.gn b/ipc/native/test/fuzztest/c/getfeaturesize_fuzzer/BUILD.gn index 573b2b64..dd37afa0 100644 --- a/ipc/native/test/fuzztest/c/getfeaturesize_fuzzer/BUILD.gn +++ b/ipc/native/test/fuzztest/c/getfeaturesize_fuzzer/BUILD.gn @@ -49,7 +49,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - #":GetFeatureSizeFuzzTest", + # ":GetFeatureSizeFuzzTest", ] } diff --git a/ipc/native/test/fuzztest/c/getrpcfeatureack_fuzzer/BUILD.gn b/ipc/native/test/fuzztest/c/getrpcfeatureack_fuzzer/BUILD.gn index af43332b..2d5a17d5 100644 --- a/ipc/native/test/fuzztest/c/getrpcfeatureack_fuzzer/BUILD.gn +++ b/ipc/native/test/fuzztest/c/getrpcfeatureack_fuzzer/BUILD.gn @@ -50,7 +50,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - #":GetRpcFeatureAckFuzzTest", + # ":GetRpcFeatureAckFuzzTest", ] } diff --git a/ipc/native/test/fuzztest/c/gettokenfromdata_fuzzer/BUILD.gn b/ipc/native/test/fuzztest/c/gettokenfromdata_fuzzer/BUILD.gn index 0bcedf09..be1d35ef 100644 --- a/ipc/native/test/fuzztest/c/gettokenfromdata_fuzzer/BUILD.gn +++ b/ipc/native/test/fuzztest/c/gettokenfromdata_fuzzer/BUILD.gn @@ -49,7 +49,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - #":GetTokenFromDataFuzzTest", + # ":GetTokenFromDataFuzzTest", ] } diff --git a/ipc/native/test/fuzztest/c/gettokenidsize_fuzzer/BUILD.gn b/ipc/native/test/fuzztest/c/gettokenidsize_fuzzer/BUILD.gn index cea2b974..b36f3f40 100644 --- a/ipc/native/test/fuzztest/c/gettokenidsize_fuzzer/BUILD.gn +++ b/ipc/native/test/fuzztest/c/gettokenidsize_fuzzer/BUILD.gn @@ -50,7 +50,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - #":GetTokenIdSizeFuzzTest", + # ":GetTokenIdSizeFuzzTest", ] } diff --git a/ipc/native/test/fuzztest/c/isatenable_fuzzer/BUILD.gn b/ipc/native/test/fuzztest/c/isatenable_fuzzer/BUILD.gn index 4bcad82e..57a3af09 100644 --- a/ipc/native/test/fuzztest/c/isatenable_fuzzer/BUILD.gn +++ b/ipc/native/test/fuzztest/c/isatenable_fuzzer/BUILD.gn @@ -49,7 +49,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - #":IsATEnableFuzzTest", + # ":IsATEnableFuzzTest", ] } diff --git a/ipc/native/test/fuzztest/c/isfeatureack_fuzzer/BUILD.gn b/ipc/native/test/fuzztest/c/isfeatureack_fuzzer/BUILD.gn index 36bfe6c8..509dc0fb 100644 --- a/ipc/native/test/fuzztest/c/isfeatureack_fuzzer/BUILD.gn +++ b/ipc/native/test/fuzztest/c/isfeatureack_fuzzer/BUILD.gn @@ -50,7 +50,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - #":IsFeatureAckFuzzTest", + # ":IsFeatureAckFuzzTest", ] } diff --git a/ipc/native/test/fuzztest/c/setfeaturetransdata_fuzzer/BUILD.gn b/ipc/native/test/fuzztest/c/setfeaturetransdata_fuzzer/BUILD.gn index 2a980fff..84453a6a 100644 --- a/ipc/native/test/fuzztest/c/setfeaturetransdata_fuzzer/BUILD.gn +++ b/ipc/native/test/fuzztest/c/setfeaturetransdata_fuzzer/BUILD.gn @@ -50,7 +50,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - #":SetFeatureTransDataFuzzTest", + # ":SetFeatureTransDataFuzzTest", ] } diff --git a/ipc/native/test/fuzztest/core/bufferobject_fuzzer/BUILD.gn b/ipc/native/test/fuzztest/core/bufferobject_fuzzer/BUILD.gn index 174cbeb4..0868dee0 100644 --- a/ipc/native/test/fuzztest/core/bufferobject_fuzzer/BUILD.gn +++ b/ipc/native/test/fuzztest/core/bufferobject_fuzzer/BUILD.gn @@ -52,7 +52,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - #":BufferObjectFuzzTest", + # ":BufferObjectFuzzTest", ] } diff --git a/services/dbinder/test/fuzztest/closedatabussession_fuzzer/BUILD.gn b/services/dbinder/test/fuzztest/closedatabussession_fuzzer/BUILD.gn index 93828baa..bbaa0488 100644 --- a/services/dbinder/test/fuzztest/closedatabussession_fuzzer/BUILD.gn +++ b/services/dbinder/test/fuzztest/closedatabussession_fuzzer/BUILD.gn @@ -49,7 +49,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - #":CloseDatabusSessionFuzzTest", + # ":CloseDatabusSessionFuzzTest", ] } ############################################################################### diff --git a/services/dbinder/test/fuzztest/dbinderservice_fuzzer/BUILD.gn b/services/dbinder/test/fuzztest/dbinderservice_fuzzer/BUILD.gn index df30fb79..f8fc4c58 100644 --- a/services/dbinder/test/fuzztest/dbinderservice_fuzzer/BUILD.gn +++ b/services/dbinder/test/fuzztest/dbinderservice_fuzzer/BUILD.gn @@ -43,7 +43,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - #":DBinderServiceFuzzTest", + # ":DBinderServiceFuzzTest", ] } ############################################################################### diff --git a/services/dbinder/test/fuzztest/detachproxyobject_fuzzer/BUILD.gn b/services/dbinder/test/fuzztest/detachproxyobject_fuzzer/BUILD.gn index 7d5c83e0..529757f2 100644 --- a/services/dbinder/test/fuzztest/detachproxyobject_fuzzer/BUILD.gn +++ b/services/dbinder/test/fuzztest/detachproxyobject_fuzzer/BUILD.gn @@ -46,7 +46,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - #":DetachProxyObjectFuzzTest", + # ":DetachProxyObjectFuzzTest", ] } ############################################################################### diff --git a/services/dbinder/test/fuzztest/loadsystemabilitycomplete_fuzzer/BUILD.gn b/services/dbinder/test/fuzztest/loadsystemabilitycomplete_fuzzer/BUILD.gn index abd97e7c..405147a6 100644 --- a/services/dbinder/test/fuzztest/loadsystemabilitycomplete_fuzzer/BUILD.gn +++ b/services/dbinder/test/fuzztest/loadsystemabilitycomplete_fuzzer/BUILD.gn @@ -45,7 +45,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - #":LoadSystemAbilityCompleteFuzzTest", + # ":LoadSystemAbilityCompleteFuzzTest", ] } ############################################################################### diff --git a/services/dbinder/test/fuzztest/noticedevicedie_fuzzer/BUILD.gn b/services/dbinder/test/fuzztest/noticedevicedie_fuzzer/BUILD.gn index d0ad0937..a4c57062 100644 --- a/services/dbinder/test/fuzztest/noticedevicedie_fuzzer/BUILD.gn +++ b/services/dbinder/test/fuzztest/noticedevicedie_fuzzer/BUILD.gn @@ -43,7 +43,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - #":NoticeDeviceDieFuzzTest", + # ":NoticeDeviceDieFuzzTest", ] } ############################################################################### diff --git a/services/dbinder/test/fuzztest/noticeservicedie_fuzzer/BUILD.gn b/services/dbinder/test/fuzztest/noticeservicedie_fuzzer/BUILD.gn index 651a7e2c..344efd40 100644 --- a/services/dbinder/test/fuzztest/noticeservicedie_fuzzer/BUILD.gn +++ b/services/dbinder/test/fuzztest/noticeservicedie_fuzzer/BUILD.gn @@ -43,7 +43,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - #":NoticeServiceDieFuzzTest", + # ":NoticeServiceDieFuzzTest", ] } ############################################################################### diff --git a/services/dbinder/test/fuzztest/onbytesreceived_fuzzer/BUILD.gn b/services/dbinder/test/fuzztest/onbytesreceived_fuzzer/BUILD.gn index a0ceb521..f6ef2854 100644 --- a/services/dbinder/test/fuzztest/onbytesreceived_fuzzer/BUILD.gn +++ b/services/dbinder/test/fuzztest/onbytesreceived_fuzzer/BUILD.gn @@ -46,7 +46,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - #":OnBytesReceivedFuzzTest", + # ":OnBytesReceivedFuzzTest", ] } ############################################################################### diff --git a/services/dbinder/test/fuzztest/senddatatoremote_fuzzer/BUILD.gn b/services/dbinder/test/fuzztest/senddatatoremote_fuzzer/BUILD.gn index f39693c2..1af77051 100644 --- a/services/dbinder/test/fuzztest/senddatatoremote_fuzzer/BUILD.gn +++ b/services/dbinder/test/fuzztest/senddatatoremote_fuzzer/BUILD.gn @@ -46,7 +46,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - #":SendDataToRemoteFuzzTest", + # ":SendDataToRemoteFuzzTest", ] } ###############################################################################