mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-27 00:20:44 +00:00
Merge branch 'master' of gitee.com:openharmony/ability_dmsfwk into master
Signed-off-by: zhx <zhuhuixuan@huawei.com>
This commit is contained in:
commit
30534bba3c
@ -15,9 +15,12 @@ group("fuzztest") {
|
||||
testonly = true
|
||||
|
||||
deps = [
|
||||
"abilityconnectionwrapperstub_fuzzer:fuzztest",
|
||||
"bundlemanagercallbackstub_fuzzer:fuzztest",
|
||||
"continuationmanager_fuzzer:fuzztest",
|
||||
"distributedschedstub_fuzzer:fuzztest",
|
||||
"distributedwant_fuzzer:fuzztest",
|
||||
"distributedwantparams_fuzzer:fuzztest",
|
||||
"dmsfreeinstallcallbackstub_fuzzer:fuzztest",
|
||||
]
|
||||
}
|
||||
|
96
test/fuzztest/abilityconnectionwrapperstub_fuzzer/BUILD.gn
Normal file
96
test/fuzztest/abilityconnectionwrapperstub_fuzzer/BUILD.gn
Normal file
@ -0,0 +1,96 @@
|
||||
# Copyright (c) 2024 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/ohos.gni")
|
||||
import("//build/test.gni")
|
||||
import("//foundation/ability/dmsfwk/dmsfwk.gni")
|
||||
ohos_fuzztest("AbilityConnectionWrapperStubFuzzTest") {
|
||||
module_out_path = module_output_path
|
||||
|
||||
visibility = [ ":*" ]
|
||||
include_dirs = [
|
||||
"${dms_path}/common/include/",
|
||||
"${dms_path}/interfaces/innerkits/common/include/",
|
||||
"${dms_path}/services/dtbschedmgr/include/",
|
||||
"${dms_path}/services/dtbschedmgr/include/collaborate/",
|
||||
"${dms_path}/services/dtbschedmgr/test/unittest",
|
||||
"${dms_path}/test/fuzztest/abilityconnectionwrapperstub_fuzzer",
|
||||
]
|
||||
|
||||
fuzz_config_file =
|
||||
"${dms_path}/test/fuzztest/abilityconnectionwrapperstub_fuzzer"
|
||||
|
||||
configs = [ "${dms_path}/services/dtbschedmgr/test/resource:coverage_flags" ]
|
||||
|
||||
cflags = [
|
||||
"-g",
|
||||
"-O0",
|
||||
"-Wno-unused-variable",
|
||||
"-fno-omit-frame-pointer",
|
||||
"-Dprivate=public",
|
||||
]
|
||||
|
||||
sources = [
|
||||
"${dms_path}/services/dtbschedmgr/test/unittest/mock_distributed_sched.cpp",
|
||||
"abilityconnectionwrapperstub_fuzzer.cpp",
|
||||
]
|
||||
|
||||
deps = [ "${dms_path}/services/dtbschedmgr:distributedschedsvr" ]
|
||||
|
||||
defines = []
|
||||
if (dmsfwk_mission_manager) {
|
||||
defines += [ "SUPPORT_DISTRIBUTED_MISSION_MANAGER" ]
|
||||
}
|
||||
|
||||
external_deps = [
|
||||
"ability_base:base",
|
||||
"ability_base:want",
|
||||
"ability_base:zuri",
|
||||
"ability_runtime:ability_manager",
|
||||
"ability_runtime:app_manager",
|
||||
"ability_runtime:dataobs_manager",
|
||||
"ability_runtime:mission_info",
|
||||
"access_token:libaccesstoken_sdk",
|
||||
"access_token:libnativetoken_shared",
|
||||
"access_token:libtokensetproc_shared",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"cJSON:cjson",
|
||||
"c_utils:utils",
|
||||
"data_share:datashare_consumer",
|
||||
"device_auth:deviceauth_sdk",
|
||||
"device_info_manager:distributed_device_profile_common",
|
||||
"device_info_manager:distributed_device_profile_sdk",
|
||||
"device_manager:devicemanagersdk",
|
||||
"device_security_level:dslm_sdk",
|
||||
"distributed_bundle_framework:dbms_fwk",
|
||||
"dsoftbus:softbus_client",
|
||||
"eventhandler:libeventhandler",
|
||||
"hilog:libhilog",
|
||||
"hisysevent:libhisysevent",
|
||||
"hitrace:hitrace_meter",
|
||||
"hitrace:libhitracechain",
|
||||
"init:libbegetutil",
|
||||
"ipc:ipc_core",
|
||||
"kv_store:distributeddata_inner",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
}
|
||||
|
||||
group("fuzztest") {
|
||||
testonly = true
|
||||
deps = [ ":AbilityConnectionWrapperStubFuzzTest" ]
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 "abilityconnectionwrapperstub_fuzzer.h"
|
||||
|
||||
#include "ability_connection_wrapper_stub.h"
|
||||
#include "mock_distributed_sched.h"
|
||||
#include "parcel_helper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
using namespace AAFwk;
|
||||
|
||||
bool OnAbilityConnectDoneFuzzTest(const uint8_t* data, size_t size)
|
||||
{
|
||||
if ((data == nullptr) || (size < sizeof(int32_t))) {
|
||||
return false;
|
||||
}
|
||||
sptr<IRemoteObject> connection(new MockDistributedSched());
|
||||
std::string localDeviceId(reinterpret_cast<const char*>(data), size);
|
||||
std::shared_ptr<AbilityConnectionWrapperStub> abilityConnection_ =
|
||||
std::make_shared<AbilityConnectionWrapperStub>(connection, localDeviceId);
|
||||
uint32_t code = IAbilityConnection::ON_ABILITY_CONNECT_DONE;
|
||||
int32_t resultCode = *(reinterpret_cast<const int32_t*>(data));
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
dataParcel.WriteInt32(resultCode);
|
||||
abilityConnection_->OnRemoteRequest(code, dataParcel, reply, option);
|
||||
|
||||
std::u16string descriptor = IAbilityConnection::GetDescriptor();
|
||||
dataParcel.WriteInterfaceToken(descriptor);
|
||||
abilityConnection_->OnRemoteRequest(code, dataParcel, reply, option);
|
||||
|
||||
std::string str1(reinterpret_cast<const char*>(data), size);
|
||||
std::string str2(reinterpret_cast<const char*>(data), size);
|
||||
std::string str3(reinterpret_cast<const char*>(data), size);
|
||||
AppExecFwk::ElementName element(str1, str2, str3);
|
||||
dataParcel.WriteParcelable(&element);
|
||||
abilityConnection_->OnRemoteRequest(code, dataParcel, reply, option);
|
||||
|
||||
dataParcel.WriteRemoteObject(connection);
|
||||
abilityConnection_->OnRemoteRequest(code, dataParcel, reply, option);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OnAbilityDisconnectDoneFuzzTest(const uint8_t* data, size_t size)
|
||||
{
|
||||
if ((data == nullptr) || (size < sizeof(int32_t))) {
|
||||
return false;
|
||||
}
|
||||
sptr<IRemoteObject> connection(new MockDistributedSched());
|
||||
std::shared_ptr<AbilityConnectionWrapperStub> abilityConnection_ =
|
||||
std::make_shared<AbilityConnectionWrapperStub>(connection);
|
||||
uint32_t code = IAbilityConnection::ON_ABILITY_DISCONNECT_DONE;
|
||||
int32_t resultCode = *(reinterpret_cast<const int32_t*>(data));
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
dataParcel.WriteInt32(resultCode);
|
||||
std::string str1(reinterpret_cast<const char*>(data), size);
|
||||
std::string str2(reinterpret_cast<const char*>(data), size);
|
||||
std::string str3(reinterpret_cast<const char*>(data), size);
|
||||
std::u16string descriptor = IAbilityConnection::GetDescriptor();
|
||||
dataParcel.WriteInterfaceToken(descriptor);
|
||||
AppExecFwk::ElementName element(str1, str2, str3);
|
||||
dataParcel.WriteParcelable(&element);
|
||||
dataParcel.WriteRemoteObject(connection);
|
||||
abilityConnection_->OnRemoteRequest(code, dataParcel, reply, option);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Fuzzer entry point */
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
OHOS::DistributedSchedule::OnAbilityConnectDoneFuzzTest(data, size);
|
||||
OHOS::DistributedSchedule::OnAbilityDisconnectDoneFuzzTest(data, size);
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* 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 OHOS_ABILITYCONNECTIONWRAPPERSTUB_FUZZER_H
|
||||
#define OHOS_ABILITYCONNECTIONWRAPPERSTUB_FUZZER_H
|
||||
|
||||
#define FUZZ_PROJECT_NAME "abilityconnectionwrapperstub_fuzzer"
|
||||
|
||||
#endif
|
@ -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
|
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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_config>
|
||||
<fuzztest>
|
||||
<!-- maximum length of a test input -->
|
||||
<max_len>1000</max_len>
|
||||
<!-- maximum total time in seconds to run the fuzzer -->
|
||||
<max_total_time>300</max_total_time>
|
||||
<!-- memory usage limit in Mb -->
|
||||
<rss_limit_mb>4096</rss_limit_mb>
|
||||
</fuzztest>
|
||||
</fuzz_config>
|
92
test/fuzztest/bundlemanagercallbackstub_fuzzer/BUILD.gn
Normal file
92
test/fuzztest/bundlemanagercallbackstub_fuzzer/BUILD.gn
Normal file
@ -0,0 +1,92 @@
|
||||
# Copyright (c) 2024 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/ohos.gni")
|
||||
import("//build/test.gni")
|
||||
import("//foundation/ability/dmsfwk/dmsfwk.gni")
|
||||
ohos_fuzztest("BundleManagerCallBackStubFuzzTest") {
|
||||
module_out_path = module_output_path
|
||||
|
||||
visibility = [ ":*" ]
|
||||
include_dirs = [
|
||||
"${dms_path}/common/include/",
|
||||
"${dms_path}/interfaces/innerkits/common/include/",
|
||||
"${dms_path}/services/dtbschedmgr/include/",
|
||||
"${dms_path}/services/dtbschedmgr/include/collaborate/",
|
||||
"${dms_path}/test/fuzztest/bundlemanagercallbackstub_fuzzer",
|
||||
]
|
||||
|
||||
fuzz_config_file =
|
||||
"${dms_path}/test/fuzztest/bundlemanagercallbackstub_fuzzer"
|
||||
|
||||
configs = [ "${dms_path}/services/dtbschedmgr/test/resource:coverage_flags" ]
|
||||
|
||||
cflags = [
|
||||
"-g",
|
||||
"-O0",
|
||||
"-Wno-unused-variable",
|
||||
"-fno-omit-frame-pointer",
|
||||
"-Dprivate=public",
|
||||
]
|
||||
|
||||
sources = [ "bundlemanagercallbackstub_fuzzer.cpp" ]
|
||||
|
||||
deps = [ "${dms_path}/services/dtbschedmgr:distributedschedsvr" ]
|
||||
|
||||
defines = []
|
||||
if (dmsfwk_mission_manager) {
|
||||
defines += [ "SUPPORT_DISTRIBUTED_MISSION_MANAGER" ]
|
||||
}
|
||||
|
||||
external_deps = [
|
||||
"ability_base:base",
|
||||
"ability_base:want",
|
||||
"ability_base:zuri",
|
||||
"ability_runtime:ability_manager",
|
||||
"ability_runtime:app_manager",
|
||||
"ability_runtime:dataobs_manager",
|
||||
"ability_runtime:mission_info",
|
||||
"access_token:libaccesstoken_sdk",
|
||||
"access_token:libnativetoken_shared",
|
||||
"access_token:libtokensetproc_shared",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"cJSON:cjson",
|
||||
"c_utils:utils",
|
||||
"data_share:datashare_consumer",
|
||||
"device_auth:deviceauth_sdk",
|
||||
"device_info_manager:distributed_device_profile_common",
|
||||
"device_info_manager:distributed_device_profile_sdk",
|
||||
"device_manager:devicemanagersdk",
|
||||
"device_security_level:dslm_sdk",
|
||||
"distributed_bundle_framework:dbms_fwk",
|
||||
"dsoftbus:softbus_client",
|
||||
"eventhandler:libeventhandler",
|
||||
"hilog:libhilog",
|
||||
"hisysevent:libhisysevent",
|
||||
"hitrace:hitrace_meter",
|
||||
"hitrace:libhitracechain",
|
||||
"init:libbegetutil",
|
||||
"ipc:ipc_core",
|
||||
"kv_store:distributeddata_inner",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
}
|
||||
|
||||
group("fuzztest") {
|
||||
testonly = true
|
||||
deps = [ ":BundleManagerCallBackStubFuzzTest" ]
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 "bundlemanagercallbackstub_fuzzer.h"
|
||||
|
||||
#include "bundle/bundle_manager_callback_stub.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
|
||||
bool OnQueryInstallationFinishedInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
{
|
||||
if ((data == nullptr) || (size < sizeof(int32_t))) {
|
||||
return false;
|
||||
}
|
||||
std::shared_ptr<DmsBundleManagerCallbackStub> bundleManager_ =
|
||||
std::make_shared<DmsBundleManagerCallbackStub>();
|
||||
uint32_t code = 0;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
bundleManager_->OnRemoteRequest(code, dataParcel, reply, option);
|
||||
|
||||
std::u16string descriptor = bundleManager_->GetDescriptor();
|
||||
dataParcel.WriteInterfaceToken(descriptor);
|
||||
bundleManager_->OnRemoteRequest(code, dataParcel, reply, option);
|
||||
|
||||
code = static_cast<uint32_t>(IDBundleManagerCallbackInterfaceCod::ON_QUERY_INSTALLATION_DONE);
|
||||
int32_t resultCode = *(reinterpret_cast<const int32_t*>(data));
|
||||
uint32_t versionCode = *(reinterpret_cast<const uint32_t*>(data));
|
||||
int32_t missionId = *(reinterpret_cast<const int32_t*>(data));
|
||||
dataParcel.WriteInt32(resultCode);
|
||||
dataParcel.WriteUint32(versionCode);
|
||||
dataParcel.WriteInt32(missionId);
|
||||
bundleManager_->OnRemoteRequest(code, dataParcel, reply, option);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Fuzzer entry point */
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
OHOS::DistributedSchedule::OnQueryInstallationFinishedInnerFuzzTest(data, size);
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 OHOS_BUNDLEMANAGERCALLBACKSTUB_FUZZER_H
|
||||
#define OHOS_BUNDLEMANAGERCALLBACKSTUB_FUZZER_H
|
||||
|
||||
#define FUZZ_PROJECT_NAME "bundlemanagercallbackstub_fuzzer"
|
||||
|
||||
#endif
|
16
test/fuzztest/bundlemanagercallbackstub_fuzzer/corpus/init
Normal file
16
test/fuzztest/bundlemanagercallbackstub_fuzzer/corpus/init
Normal file
@ -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
|
25
test/fuzztest/bundlemanagercallbackstub_fuzzer/project.xml
Normal file
25
test/fuzztest/bundlemanagercallbackstub_fuzzer/project.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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_config>
|
||||
<fuzztest>
|
||||
<!-- maximum length of a test input -->
|
||||
<max_len>1000</max_len>
|
||||
<!-- maximum total time in seconds to run the fuzzer -->
|
||||
<max_total_time>300</max_total_time>
|
||||
<!-- memory usage limit in Mb -->
|
||||
<rss_limit_mb>4096</rss_limit_mb>
|
||||
</fuzztest>
|
||||
</fuzz_config>
|
@ -41,20 +41,22 @@ bool StartRemoteAbilityInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
if ((data == nullptr) || (size < sizeof(int32_t))) {
|
||||
return false;
|
||||
}
|
||||
FuzzUtil::MockPermission();
|
||||
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY);
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
Want want;
|
||||
int32_t callerUid = *(reinterpret_cast<const int32_t*>(data));
|
||||
int32_t requestCode = *(reinterpret_cast<const int32_t*>(data));
|
||||
uint32_t accessToken = *(reinterpret_cast<const uint32_t*>(data));
|
||||
sptr<IRemoteObject> connect;
|
||||
int32_t int32Data = *(reinterpret_cast<const int32_t*>(data));
|
||||
uint32_t uint32Data = *(reinterpret_cast<const uint32_t*>(data));
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
dataParcel.WriteParcelable(&want);
|
||||
dataParcel.WriteInt32(callerUid);
|
||||
dataParcel.WriteInt32(requestCode);
|
||||
dataParcel.WriteUint32(accessToken);
|
||||
PARCEL_WRITE_HELPER(dataParcel, Parcelable, &want);
|
||||
PARCEL_WRITE_HELPER(dataParcel, RemoteObject, connect);
|
||||
PARCEL_WRITE_HELPER(dataParcel, Int32, int32Data);
|
||||
PARCEL_WRITE_HELPER(dataParcel, Int32, int32Data);
|
||||
PARCEL_WRITE_HELPER(dataParcel, Uint32, uint32Data);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
FuzzUtil::MockPermission();
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
return true;
|
||||
}
|
||||
@ -70,14 +72,15 @@ void ConnectRemoteAbilityInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
Want want;
|
||||
int32_t callerUid = *(reinterpret_cast<const int32_t*>(data));
|
||||
int32_t callerPid = *(reinterpret_cast<const int32_t*>(data));
|
||||
uint32_t accessToken = *(reinterpret_cast<const int32_t*>(data));
|
||||
sptr<IRemoteObject> connect;
|
||||
int32_t int32Data = *(reinterpret_cast<const int32_t*>(data));
|
||||
uint32_t uint32Data = *(reinterpret_cast<const uint32_t*>(data));
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
dataParcel.WriteParcelable(&want);
|
||||
dataParcel.WriteInt32(callerUid);
|
||||
dataParcel.WriteInt32(callerPid);
|
||||
dataParcel.WriteUint32(accessToken);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Parcelable, &want);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, RemoteObject, connect);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int32, int32Data);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int32, int32Data);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Uint32, uint32Data);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
@ -91,11 +94,12 @@ void DisconnectRemoteAbilityInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
int32_t callerUid = *(reinterpret_cast<const int32_t*>(data));
|
||||
uint32_t accessToken = *(reinterpret_cast<const int32_t*>(data));
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
dataParcel.WriteInt32(callerUid);
|
||||
dataParcel.WriteUint32(accessToken);
|
||||
sptr<IRemoteObject> connect;
|
||||
int32_t int32Data = *(reinterpret_cast<const int32_t*>(data));
|
||||
uint32_t uint32Data = *(reinterpret_cast<const uint32_t*>(data));
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, RemoteObject, connect);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int32, int32Data);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Uint32, uint32Data);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
@ -149,15 +153,21 @@ void ContinueMissionInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
return;
|
||||
}
|
||||
FuzzUtil::MockPermission();
|
||||
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::CONTINUE_MISSION);
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
std::string srcDevId(reinterpret_cast<const char*>(data), size);
|
||||
std::string dstDevId(reinterpret_cast<const char*>(data), size);
|
||||
int32_t missionId = *(reinterpret_cast<const int32_t*>(data));
|
||||
dataParcel.WriteString(srcDevId);
|
||||
dataParcel.WriteString(dstDevId);
|
||||
dataParcel.WriteInt32(missionId);
|
||||
DistributedSchedService::GetInstance().ContinueMissionInner(dataParcel, reply);
|
||||
MessageOption option;
|
||||
int32_t int32Data = *(reinterpret_cast<const int32_t*>(data));
|
||||
std::string str(reinterpret_cast<const char*>(data), size);
|
||||
sptr<IRemoteObject> callback;
|
||||
WantParams wantParams;
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int32, int32Data);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, RemoteObject, callback);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Parcelable, &wantParams);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
void ContinueMissionOfBundleNameInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
@ -166,15 +176,20 @@ void ContinueMissionOfBundleNameInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
return;
|
||||
}
|
||||
FuzzUtil::MockPermission();
|
||||
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::CONTINUE_MISSION_OF_BUNDLENAME);
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
std::string srcDevId(reinterpret_cast<const char*>(data), size);
|
||||
std::string dstDevId(reinterpret_cast<const char*>(data), size);
|
||||
std::string bundleName(reinterpret_cast<const char*>(data), size);
|
||||
dataParcel.WriteString(srcDevId);
|
||||
dataParcel.WriteString(dstDevId);
|
||||
dataParcel.WriteString(bundleName);
|
||||
DistributedSchedService::GetInstance().ContinueMissionOfBundleNameInner(dataParcel, reply);
|
||||
MessageOption option;
|
||||
std::string str(reinterpret_cast<const char*>(data), size);
|
||||
sptr<IRemoteObject> callback;
|
||||
WantParams wantParams;
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, RemoteObject, callback);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Parcelable, &wantParams);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
void GetMissionInfosInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
@ -187,9 +202,11 @@ void GetMissionInfosInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
int32_t numMissions = *(reinterpret_cast<const int32_t*>(data));
|
||||
int32_t int32Data = *(reinterpret_cast<const int32_t*>(data));
|
||||
std::string str(reinterpret_cast<const char*>(data), size);
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
dataParcel.WriteInt32(numMissions);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int32, int32Data);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
@ -203,7 +220,11 @@ void RegisterMissionListenerInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
std::string str(reinterpret_cast<const char*>(data), size);
|
||||
sptr<IRemoteObject> obj;
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, RemoteObject, obj);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
@ -217,7 +238,11 @@ void UnRegisterMissionListenerInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
std::string str(reinterpret_cast<const char*>(data), size);
|
||||
sptr<IRemoteObject> obj;
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, RemoteObject, obj);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
@ -231,7 +256,13 @@ void StartSyncRemoteMissionsInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
int32_t boolData = *(reinterpret_cast<const bool*>(data));
|
||||
int32_t int64Data = *(reinterpret_cast<const int64_t*>(data));
|
||||
std::string str(reinterpret_cast<const char*>(data), size);
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Bool, boolData);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int64, int64Data);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
@ -245,7 +276,9 @@ void StopSyncRemoteMissionsInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
std::string str(reinterpret_cast<const char*>(data), size);
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
@ -277,11 +310,16 @@ void StartRemoteAbilityByCallInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
std::string networkId(reinterpret_cast<const char*>(data), size);
|
||||
int32_t missionId = *(reinterpret_cast<const int32_t*>(data));
|
||||
Want want;
|
||||
sptr<IRemoteObject> obj;
|
||||
int32_t int32Data = *(reinterpret_cast<const int32_t*>(data));
|
||||
uint32_t uint32Data = *(reinterpret_cast<const uint32_t*>(data));
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
dataParcel.WriteString(networkId);
|
||||
dataParcel.WriteInt32(missionId);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Parcelable, &want);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, RemoteObject, obj);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int32, int32Data);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int32, int32Data);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Uint32, uint32Data);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
@ -295,7 +333,11 @@ void ReleaseRemoteAbilityInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
sptr<IRemoteObject> connect;
|
||||
AppExecFwk::ElementName element;
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, RemoteObject, connect);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Parcelable, &element);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
@ -305,9 +347,12 @@ void GetDistributedComponentListInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
return;
|
||||
}
|
||||
FuzzUtil::MockPermission();
|
||||
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::GET_DISTRIBUTED_COMPONENT_LIST);
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
DistributedSchedService::GetInstance().GetDistributedComponentListInner(dataParcel, reply);
|
||||
MessageOption option;
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
void StartRemoteFreeInstallInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
@ -320,13 +365,16 @@ void StartRemoteFreeInstallInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
int32_t callerUid = *(reinterpret_cast<const int32_t*>(data));
|
||||
int32_t requestCode = *(reinterpret_cast<const int32_t*>(data));
|
||||
uint32_t accessToken = *(reinterpret_cast<const int32_t*>(data));
|
||||
int32_t int32Data = *(reinterpret_cast<const int32_t*>(data));
|
||||
uint32_t uint32Data = *(reinterpret_cast<const uint32_t*>(data));
|
||||
sptr<IRemoteObject> obj;
|
||||
Want want;
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
dataParcel.WriteInt32(callerUid);
|
||||
dataParcel.WriteInt32(requestCode);
|
||||
dataParcel.WriteUint32(accessToken);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Parcelable, &want);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, RemoteObject, obj);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int32, int32Data);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int32, int32Data);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Uint32, uint32Data);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
@ -340,9 +388,11 @@ void StartRemoteShareFormInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
std::string deviceId(reinterpret_cast<const char*>(data), size);
|
||||
std::string str(reinterpret_cast<const char*>(data), size);
|
||||
Want want;
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
dataParcel.WriteString(deviceId);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Parcelable, &want);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
@ -375,9 +425,11 @@ void RegisterOnListenerInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
std::string type(reinterpret_cast<const char*>(data), size);
|
||||
std::string str(reinterpret_cast<const char*>(data), size);
|
||||
sptr<IRemoteObject> obj;
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
dataParcel.WriteString(type);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, RemoteObject, obj);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
@ -391,9 +443,11 @@ void RegisterOffListenerInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
std::string type(reinterpret_cast<const char*>(data), size);
|
||||
std::string str(reinterpret_cast<const char*>(data), size);
|
||||
sptr<IRemoteObject> obj;
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
dataParcel.WriteString(type);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, RemoteObject, obj);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
@ -407,7 +461,11 @@ void RegisterDSchedEventListenerInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
std::string str(reinterpret_cast<const char*>(data), size);
|
||||
sptr<IRemoteObject> obj;
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, RemoteObject, obj);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
@ -421,7 +479,11 @@ void UnRegisterDSchedEventListenerInnerFuzzTest(const uint8_t* data, size_t size
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
std::string str(reinterpret_cast<const char*>(data), size);
|
||||
sptr<IRemoteObject> obj;
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, RemoteObject, obj);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
@ -704,6 +766,74 @@ void NotifyStateChangedFromRemoteInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
}
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
void StartFreeInstallFromRemoteInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
{
|
||||
if ((data == nullptr) || (size < sizeof(int32_t))) {
|
||||
return;
|
||||
}
|
||||
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_FREE_INSTALL_FROM_REMOTE);
|
||||
FuzzUtil::MockPermission();
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
int32_t int32Data = *(reinterpret_cast<const int32_t*>(data));
|
||||
int32_t int64Data = *(reinterpret_cast<const int64_t*>(data));
|
||||
std::string str(reinterpret_cast<const char*>(data), size);
|
||||
std::vector<std::string> strVector = {str};
|
||||
DistributedWant dstbWant;
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Parcelable, &dstbWant);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int32, int32Data);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int32, int32Data);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, StringVector, strVector);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int64, int64Data);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, String, str);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
void NotifyCompleteFreeInstallFromRemoteInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
{
|
||||
if ((data == nullptr) || (size < sizeof(int32_t))) {
|
||||
return;
|
||||
}
|
||||
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::NOTIFY_COMPLETE_FREE_INSTALL_FROM_REMOTE);
|
||||
FuzzUtil::MockPermission();
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
int32_t int32Data = *(reinterpret_cast<const int32_t*>(data));
|
||||
int32_t int64Data = *(reinterpret_cast<const int64_t*>(data));
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int64, int64Data);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int32, int32Data);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
|
||||
void StopRemoteExtensionAbilityInner(const uint8_t* data, size_t size)
|
||||
{
|
||||
if ((data == nullptr) || (size < sizeof(int32_t))) {
|
||||
return;
|
||||
}
|
||||
int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::STOP_REMOTE_EXTERNSION_ABILITY);
|
||||
FuzzUtil::MockPermission();
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
int32_t int32Data = *(reinterpret_cast<const int32_t*>(data));
|
||||
uint32_t uint32Data = *(reinterpret_cast<const uint32_t*>(data));
|
||||
std::string str(reinterpret_cast<const char*>(data), size);
|
||||
std::vector<std::string> strVector = {str};
|
||||
Want want;
|
||||
dataParcel.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Parcelable, &want);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int32, int32Data);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Uint32, uint32Data);
|
||||
PARCEL_WRITE_HELPER_NORET(dataParcel, Int32, int32Data);
|
||||
DistributedSchedService::GetInstance().OnRemoteRequest(code, dataParcel, reply, option);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -745,5 +875,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
OHOS::DistributedSchedule::NotifyMissionsChangedFromRemoteInnerFuzzTest(data, size);
|
||||
OHOS::DistributedSchedule::ReleaseAbilityFromRemoteInnerFuzzTest(data, size);
|
||||
OHOS::DistributedSchedule::NotifyStateChangedFromRemoteInnerFuzzTest(data, size);
|
||||
OHOS::DistributedSchedule::StartFreeInstallFromRemoteInnerFuzzTest(data, size);
|
||||
OHOS::DistributedSchedule::NotifyCompleteFreeInstallFromRemoteInnerFuzzTest(data, size);
|
||||
OHOS::DistributedSchedule::StopRemoteExtensionAbilityInner(data, size);
|
||||
return 0;
|
||||
}
|
92
test/fuzztest/dmsfreeinstallcallbackstub_fuzzer/BUILD.gn
Normal file
92
test/fuzztest/dmsfreeinstallcallbackstub_fuzzer/BUILD.gn
Normal file
@ -0,0 +1,92 @@
|
||||
# Copyright (c) 2024 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/ohos.gni")
|
||||
import("//build/test.gni")
|
||||
import("//foundation/ability/dmsfwk/dmsfwk.gni")
|
||||
ohos_fuzztest("DmsFreeInstallCallBackStubFuzzTest") {
|
||||
module_out_path = module_output_path
|
||||
|
||||
visibility = [ ":*" ]
|
||||
include_dirs = [
|
||||
"${dms_path}/common/include/",
|
||||
"${dms_path}/interfaces/innerkits/common/include/",
|
||||
"${dms_path}/services/dtbschedmgr/include/",
|
||||
"${dms_path}/services/dtbschedmgr/include/collaborate/",
|
||||
"${dms_path}/test/fuzztest/dmsfreeinstallcallbackstub_fuzzer",
|
||||
]
|
||||
|
||||
fuzz_config_file =
|
||||
"${dms_path}/test/fuzztest/dmsfreeinstallcallbackstub_fuzzer"
|
||||
|
||||
configs = [ "${dms_path}/services/dtbschedmgr/test/resource:coverage_flags" ]
|
||||
|
||||
cflags = [
|
||||
"-g",
|
||||
"-O0",
|
||||
"-Wno-unused-variable",
|
||||
"-fno-omit-frame-pointer",
|
||||
"-Dprivate=public",
|
||||
]
|
||||
|
||||
sources = [ "dmsfreeinstallcallbackstub_fuzzer.cpp" ]
|
||||
|
||||
deps = [ "${dms_path}/services/dtbschedmgr:distributedschedsvr" ]
|
||||
|
||||
defines = []
|
||||
if (dmsfwk_mission_manager) {
|
||||
defines += [ "SUPPORT_DISTRIBUTED_MISSION_MANAGER" ]
|
||||
}
|
||||
|
||||
external_deps = [
|
||||
"ability_base:base",
|
||||
"ability_base:want",
|
||||
"ability_base:zuri",
|
||||
"ability_runtime:ability_manager",
|
||||
"ability_runtime:app_manager",
|
||||
"ability_runtime:dataobs_manager",
|
||||
"ability_runtime:mission_info",
|
||||
"access_token:libaccesstoken_sdk",
|
||||
"access_token:libnativetoken_shared",
|
||||
"access_token:libtokensetproc_shared",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"cJSON:cjson",
|
||||
"c_utils:utils",
|
||||
"data_share:datashare_consumer",
|
||||
"device_auth:deviceauth_sdk",
|
||||
"device_info_manager:distributed_device_profile_common",
|
||||
"device_info_manager:distributed_device_profile_sdk",
|
||||
"device_manager:devicemanagersdk",
|
||||
"device_security_level:dslm_sdk",
|
||||
"distributed_bundle_framework:dbms_fwk",
|
||||
"dsoftbus:softbus_client",
|
||||
"eventhandler:libeventhandler",
|
||||
"hilog:libhilog",
|
||||
"hisysevent:libhisysevent",
|
||||
"hitrace:hitrace_meter",
|
||||
"hitrace:libhitracechain",
|
||||
"init:libbegetutil",
|
||||
"ipc:ipc_core",
|
||||
"kv_store:distributeddata_inner",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
}
|
||||
|
||||
group("fuzztest") {
|
||||
testonly = true
|
||||
deps = [ ":DmsFreeInstallCallBackStubFuzzTest" ]
|
||||
}
|
16
test/fuzztest/dmsfreeinstallcallbackstub_fuzzer/corpus/init
Normal file
16
test/fuzztest/dmsfreeinstallcallbackstub_fuzzer/corpus/init
Normal file
@ -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
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 "dmsfreeinstallcallbackstub_fuzzer.h"
|
||||
|
||||
#include "dms_free_install_callback.h"
|
||||
#include "distributed_sched_interface.h"
|
||||
#include "parcel_helper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
namespace {
|
||||
const uint32_t ONE = 1;
|
||||
}
|
||||
bool OnInstallFinishedInnerFuzzTest(const uint8_t* data, size_t size)
|
||||
{
|
||||
if ((data == nullptr) || (size < sizeof(int32_t))) {
|
||||
return false;
|
||||
}
|
||||
int64_t taskId = 0;
|
||||
IDistributedSched::FreeInstallInfo info;
|
||||
std::shared_ptr<DmsFreeInstallCallback> freeInstall_ =
|
||||
std::make_shared<DmsFreeInstallCallback>(taskId, info);
|
||||
uint32_t code = ONE;
|
||||
MessageParcel dataParcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
std::u16string descriptor = DmsFreeInstallCallbackStub::GetDescriptor();
|
||||
freeInstall_->OnRemoteRequest(code, dataParcel, reply, option);
|
||||
|
||||
dataParcel.WriteInterfaceToken(descriptor);
|
||||
freeInstall_->OnRemoteRequest(code, dataParcel, reply, option);
|
||||
|
||||
code = static_cast<uint32_t>(IDRreeInstallCallbackInterfaceCode::ON_FREE_INSTALL_DONE);
|
||||
int32_t resultCode = *(reinterpret_cast<const int32_t*>(data));
|
||||
int32_t requestCode = *(reinterpret_cast<const int32_t*>(data));
|
||||
dataParcel.WriteInt32(resultCode);
|
||||
dataParcel.WriteInt32(requestCode);
|
||||
freeInstall_->OnRemoteRequest(code, dataParcel, reply, option);
|
||||
|
||||
AAFwk::Want want;
|
||||
dataParcel.WriteParcelable(&want);
|
||||
freeInstall_->OnRemoteRequest(code, dataParcel, reply, option);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Fuzzer entry point */
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
OHOS::DistributedSchedule::OnInstallFinishedInnerFuzzTest(data, size);
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 OHOS_DMSFREEINSTALLCALLBACKSTUB_FUZZER_H
|
||||
#define OHOS_DMSFREEINSTALLCALLBACKSTUB_FUZZER_H
|
||||
|
||||
#define FUZZ_PROJECT_NAME "dmsfreeinstallcallbackstub_fuzzer"
|
||||
|
||||
#endif
|
25
test/fuzztest/dmsfreeinstallcallbackstub_fuzzer/project.xml
Normal file
25
test/fuzztest/dmsfreeinstallcallbackstub_fuzzer/project.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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_config>
|
||||
<fuzztest>
|
||||
<!-- maximum length of a test input -->
|
||||
<max_len>1000</max_len>
|
||||
<!-- maximum total time in seconds to run the fuzzer -->
|
||||
<max_total_time>300</max_total_time>
|
||||
<!-- memory usage limit in Mb -->
|
||||
<rss_limit_mb>4096</rss_limit_mb>
|
||||
</fuzztest>
|
||||
</fuzz_config>
|
Loading…
Reference in New Issue
Block a user