From 63224738e581122e0abd5de310e90b06572fe387 Mon Sep 17 00:00:00 2001 From: zhaoyrr Date: Thu, 7 Aug 2025 22:08:07 +0800 Subject: [PATCH 1/3] add fuzz Signed-off-by: zhaoyrr --- test/fuzztest/BUILD.gn | 3 +- .../BUILD.gn | 83 +++++++++++++++++++ ...rfacesappmanageramsmgrstubfirst_fuzzer.cpp | 79 ++++++++++++++++++ ...terfacesappmanageramsmgrstubfirst_fuzzer.h | 21 +++++ .../project.xml | 25 ++++++ .../BUILD.gn | 83 +++++++++++++++++++ ...facesappmanageramsmgrstubsecond_fuzzer.cpp | 79 ++++++++++++++++++ ...erfacesappmanageramsmgrstubsecond_fuzzer.h | 21 +++++ .../project.xml | 25 ++++++ 9 files changed, 418 insertions(+), 1 deletion(-) create mode 100644 test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/BUILD.gn create mode 100644 test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/abilityinterfacesappmanageramsmgrstubfirst_fuzzer.cpp create mode 100644 test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/abilityinterfacesappmanageramsmgrstubfirst_fuzzer.h create mode 100644 test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/project.xml create mode 100644 test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/BUILD.gn create mode 100644 test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/abilityinterfacesappmanageramsmgrstubsecond_fuzzer.cpp create mode 100644 test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/abilityinterfacesappmanageramsmgrstubsecond_fuzzer.h create mode 100644 test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/project.xml diff --git a/test/fuzztest/BUILD.gn b/test/fuzztest/BUILD.gn index 58398e94a24..0a1be606d75 100644 --- a/test/fuzztest/BUILD.gn +++ b/test/fuzztest/BUILD.gn @@ -77,7 +77,8 @@ group("fuzztest") { "abilityframeworksnativejsworker_fuzzer:fuzztest", "abilityframeworksnativeohosjsenvlogger_fuzzer:fuzztest", "abilityinterfacesappmanageramsmgrstub_fuzzer:fuzztest", - "abilityinterfacesappmanageramsmgrstub_fuzzer:fuzztest", + "abilityinterfacesappmanageramsmgrstubfirst_fuzzer:fuzztest", + "abilityinterfacesappmanageramsmgrstubsecond_fuzzer:fuzztest", "abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer:fuzztest", "abilityinterfacesappmgrappdebuglistenerproxy_fuzzer:fuzztest", "abilityinterfacesappmgrappdebuglistenerstub_fuzzer:fuzztest", diff --git a/test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/BUILD.gn b/test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/BUILD.gn new file mode 100644 index 00000000000..9dc41d9c343 --- /dev/null +++ b/test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/BUILD.gn @@ -0,0 +1,83 @@ +# Copyright (c) 2025 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/ability_runtime/ability_runtime.gni") +module_output_path = "ability_runtime/abilitymgr" + +##############################fuzztest########################################## +ohos_fuzztest("AbilityInterfacesAppManagerAmsMgrStubFirstFuzzTest") { + module_out_path = module_output_path + + cflags_cc = [] + fuzz_config_file = "${ability_runtime_test_path}/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer" + include_dirs = [ "${ability_runtime_services_path}/appmgr/include" ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "abilityinterfacesappmanageramsmgrstubfirst_fuzzer.cpp" ] + + configs = [ "${ability_runtime_services_path}/abilitymgr:abilityms_config" ] + + cflags = [] + if (target_cpu == "arm") { + cflags += [ "-DBINDER_IPC_32BIT" ] + } + + deps = [ + "${ability_runtime_innerkits_path}/app_manager:app_manager", + "${ability_runtime_native_path}/ability/native:abilitykit_native", + "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/appmgr:libappms", + "${ability_runtime_services_path}/common:perm_verification", + ] + + external_deps = [ + "ability_base:session_info", + "ability_base:want", + "ability_base:zuri", + "appspawn:appspawn_client", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "ffrt:libffrt", + "hisysevent:libhisysevent", + "init:libbegetutil", + "ipc:ipc_core", + "napi:ace_napi", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + ] + + if (ability_runtime_graphics) { + external_deps += [ "input:libmmi-client" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [] + deps += [ + # deps file + ":AbilityInterfacesAppManagerAmsMgrStubFirstFuzzTest", + ] +} +############################################################################### diff --git a/test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/abilityinterfacesappmanageramsmgrstubfirst_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/abilityinterfacesappmanageramsmgrstubfirst_fuzzer.cpp new file mode 100644 index 00000000000..7627d91f051 --- /dev/null +++ b/test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/abilityinterfacesappmanageramsmgrstubfirst_fuzzer.cpp @@ -0,0 +1,79 @@ +/* + * 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 "abilityinterfacesappmanageramsmgrstubfirst_fuzzer.h" + +#include +#include +#include + +#define private public +#include "ams_mgr_stub.h" +#include "ams_mgr_scheduler.h" +#undef private + +#include "securec.h" +#include "parcel.h" +#include "ability_record.h" + +using namespace OHOS::AAFwk; +using namespace OHOS::AppExecFwk; + +namespace OHOS { +namespace { +constexpr int INPUT_ZERO = 0; +constexpr int INPUT_ONE = 1; +constexpr int INPUT_TWO = 2; +constexpr int INPUT_THREE = 3; +constexpr size_t U32_AT_SIZE = 4; +constexpr size_t OFFSET_ZERO = 24; +constexpr size_t OFFSET_ONE = 16; +constexpr size_t OFFSET_TWO = 8; +constexpr uint8_t ENABLE = 2; +constexpr size_t STRING_MAX_LENGTH = 128; +} + +const std::u16string AMSMGR_INTERFACE_TOKEN = u"ohos.appexecfwk.IAmsMgr"; +uint32_t GetU32Data(const char* ptr) +{ + // convert fuzz input data to an integer + return (ptr[INPUT_ZERO] << OFFSET_ZERO) | (ptr[INPUT_ONE] << OFFSET_ONE) | (ptr[INPUT_TWO] << OFFSET_TWO) | + ptr[INPUT_THREE]; +} + +bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) +{ + std::shared_ptr MgrServiceInner; + std::shared_ptr Handler; + std::shared_ptr amsmgr = std::make_shared(MgrServiceInner, Handler); + MessageParcel parcel; + MessageParcel reply; + FuzzedDataProvider fdp(data, size); + parcel.WriteInterfaceToken(AMSMGR_INTERFACE_TOKEN); + parcel.WriteString(fdp.ConsumeRandomLengthString(STRING_MAX_LENGTH)); + parcel.WriteInt32(fdp.ConsumeIntegral()); + parcel.RewindRead(0); + amsmgr->HandleGetRunningProcessInfoByToken(parcel, reply); + return true; +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::DoSomethingInterestingWithMyAPI(data, size); + return 0; +} diff --git a/test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/abilityinterfacesappmanageramsmgrstubfirst_fuzzer.h b/test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/abilityinterfacesappmanageramsmgrstubfirst_fuzzer.h new file mode 100644 index 00000000000..43bcc14bff2 --- /dev/null +++ b/test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/abilityinterfacesappmanageramsmgrstubfirst_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 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 FUZZTEST_OHOS_ABILITY_RUNTIME_ABILITYINTERFACESAPPMANGERAMSMGRSTUBFIRST_FUZZER_H +#define FUZZTEST_OHOS_ABILITY_RUNTIME_ABILITYINTERFACESAPPMANGERAMSMGRSTUBFIRST_FUZZER_H + +#define FUZZ_PROJECT_NAME "abilityinterfacesappmanageramsmgrstubfirst_fuzzer" + +#endif // FUZZTEST_OHOS_ABILITY_RUNTIME_ABILITYINTERFACESAPPMANGERAMSMGRSTUBFIRST_FUZZER_H diff --git a/test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/project.xml b/test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/project.xml new file mode 100644 index 00000000000..4a9e5e0e8a1 --- /dev/null +++ b/test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 600 + + 4096 + + diff --git a/test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/BUILD.gn b/test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/BUILD.gn new file mode 100644 index 00000000000..0597b83c021 --- /dev/null +++ b/test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/BUILD.gn @@ -0,0 +1,83 @@ +# Copyright (c) 2025 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/ability_runtime/ability_runtime.gni") +module_output_path = "ability_runtime/abilitymgr" + +##############################fuzztest########################################## +ohos_fuzztest("AbilityInterfacesAppManagerAmsMgrStubSecondFuzzTest") { + module_out_path = module_output_path + + cflags_cc = [] + fuzz_config_file = "${ability_runtime_test_path}/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer" + include_dirs = [ "${ability_runtime_services_path}/appmgr/include" ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "abilityinterfacesappmanageramsmgrstubsecond_fuzzer.cpp" ] + + configs = [ "${ability_runtime_services_path}/abilitymgr:abilityms_config" ] + + cflags = [] + if (target_cpu == "arm") { + cflags += [ "-DBINDER_IPC_32BIT" ] + } + + deps = [ + "${ability_runtime_innerkits_path}/app_manager:app_manager", + "${ability_runtime_native_path}/ability/native:abilitykit_native", + "${ability_runtime_services_path}/abilitymgr:abilityms", + "${ability_runtime_services_path}/appmgr:libappms", + "${ability_runtime_services_path}/common:perm_verification", + ] + + external_deps = [ + "ability_base:session_info", + "ability_base:want", + "ability_base:zuri", + "appspawn:appspawn_client", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "ffrt:libffrt", + "hisysevent:libhisysevent", + "init:libbegetutil", + "ipc:ipc_core", + "napi:ace_napi", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + ] + + if (ability_runtime_graphics) { + external_deps += [ "input:libmmi-client" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [] + deps += [ + # deps file + ":AbilityInterfacesAppManagerAmsMgrStubSecondFuzzTest", + ] +} +############################################################################### diff --git a/test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/abilityinterfacesappmanageramsmgrstubsecond_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/abilityinterfacesappmanageramsmgrstubsecond_fuzzer.cpp new file mode 100644 index 00000000000..618dec1464e --- /dev/null +++ b/test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/abilityinterfacesappmanageramsmgrstubsecond_fuzzer.cpp @@ -0,0 +1,79 @@ +/* + * 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 "abilityinterfacesappmanageramsmgrstubsecond_fuzzer.h" + +#include +#include +#include + +#define private public +#include "ams_mgr_stub.h" +#include "ams_mgr_scheduler.h" +#undef private + +#include "securec.h" +#include "parcel.h" +#include "ability_record.h" + +using namespace OHOS::AAFwk; +using namespace OHOS::AppExecFwk; + +namespace OHOS { +namespace { +constexpr int INPUT_ZERO = 0; +constexpr int INPUT_ONE = 1; +constexpr int INPUT_TWO = 2; +constexpr int INPUT_THREE = 3; +constexpr size_t U32_AT_SIZE = 4; +constexpr size_t OFFSET_ZERO = 24; +constexpr size_t OFFSET_ONE = 16; +constexpr size_t OFFSET_TWO = 8; +constexpr uint8_t ENABLE = 2; +constexpr size_t STRING_MAX_LENGTH = 128; +} + +const std::u16string AMSMGR_INTERFACE_TOKEN = u"ohos.appexecfwk.IAmsMgr"; +uint32_t GetU32Data(const char* ptr) +{ + // convert fuzz input data to an integer + return (ptr[INPUT_ZERO] << OFFSET_ZERO) | (ptr[INPUT_ONE] << OFFSET_ONE) | (ptr[INPUT_TWO] << OFFSET_TWO) | + ptr[INPUT_THREE]; +} + +bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) +{ + std::shared_ptr MgrServiceInner; + std::shared_ptr Handler; + std::shared_ptr amsmgr = std::make_shared(MgrServiceInner, Handler); + MessageParcel parcel; + MessageParcel reply; + FuzzedDataProvider fdp(data, size); + parcel.WriteInterfaceToken(AMSMGR_INTERFACE_TOKEN); + parcel.WriteString(fdp.ConsumeRandomLengthString(STRING_MAX_LENGTH)); + parcel.WriteInt32(fdp.ConsumeIntegral()); + parcel.RewindRead(0); + amsmgr->HandleKillApplication(parcel, reply); + return true; +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::DoSomethingInterestingWithMyAPI(data, size); + return 0; +} diff --git a/test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/abilityinterfacesappmanageramsmgrstubsecond_fuzzer.h b/test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/abilityinterfacesappmanageramsmgrstubsecond_fuzzer.h new file mode 100644 index 00000000000..bf9ca029e48 --- /dev/null +++ b/test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/abilityinterfacesappmanageramsmgrstubsecond_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 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 FUZZTEST_OHOS_ABILITY_RUNTIME_ABILITYINTERFACESAPPMANGERAMSMGRSTUBSECOND_FUZZER_H +#define FUZZTEST_OHOS_ABILITY_RUNTIME_ABILITYINTERFACESAPPMANGERAMSMGRSTUBSECOND_FUZZER_H + +#define FUZZ_PROJECT_NAME "abilityinterfacesappmanageramsmgrstubsecond_fuzzer" + +#endif // FUZZTEST_OHOS_ABILITY_RUNTIME_ABILITYINTERFACESAPPMANGERAMSMGRSTUBSECOND_FUZZER_H diff --git a/test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/project.xml b/test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/project.xml new file mode 100644 index 00000000000..4a9e5e0e8a1 --- /dev/null +++ b/test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 600 + + 4096 + + -- Gitee From ec0664730da179f1ffff316af51f8134cc7d27b9 Mon Sep 17 00:00:00 2001 From: zhaoyrr Date: Tue, 12 Aug 2025 02:31:48 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=86=97=E4=BD=99?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhaoyrr --- ...rfacesappmanageramsmgrstubfirst_fuzzer.cpp | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/abilityinterfacesappmanageramsmgrstubfirst_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/abilityinterfacesappmanageramsmgrstubfirst_fuzzer.cpp index 7627d91f051..ef07ef17ebf 100644 --- a/test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/abilityinterfacesappmanageramsmgrstubfirst_fuzzer.cpp +++ b/test/fuzztest/abilityinterfacesappmanageramsmgrstubfirst_fuzzer/abilityinterfacesappmanageramsmgrstubfirst_fuzzer.cpp @@ -24,35 +24,14 @@ #include "ams_mgr_scheduler.h" #undef private -#include "securec.h" -#include "parcel.h" -#include "ability_record.h" - using namespace OHOS::AAFwk; using namespace OHOS::AppExecFwk; namespace OHOS { namespace { -constexpr int INPUT_ZERO = 0; -constexpr int INPUT_ONE = 1; -constexpr int INPUT_TWO = 2; -constexpr int INPUT_THREE = 3; -constexpr size_t U32_AT_SIZE = 4; -constexpr size_t OFFSET_ZERO = 24; -constexpr size_t OFFSET_ONE = 16; -constexpr size_t OFFSET_TWO = 8; -constexpr uint8_t ENABLE = 2; constexpr size_t STRING_MAX_LENGTH = 128; } - const std::u16string AMSMGR_INTERFACE_TOKEN = u"ohos.appexecfwk.IAmsMgr"; -uint32_t GetU32Data(const char* ptr) -{ - // convert fuzz input data to an integer - return (ptr[INPUT_ZERO] << OFFSET_ZERO) | (ptr[INPUT_ONE] << OFFSET_ONE) | (ptr[INPUT_TWO] << OFFSET_TWO) | - ptr[INPUT_THREE]; -} - bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { std::shared_ptr MgrServiceInner; -- Gitee From 8c257d308b01036fb6922dac4d8afabf089cc281 Mon Sep 17 00:00:00 2001 From: zhaoyrr Date: Tue, 12 Aug 2025 02:37:41 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=86=97=E4=BD=99?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhaoyrr --- ...facesappmanageramsmgrstubsecond_fuzzer.cpp | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/abilityinterfacesappmanageramsmgrstubsecond_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/abilityinterfacesappmanageramsmgrstubsecond_fuzzer.cpp index 618dec1464e..1e2a269e4ef 100644 --- a/test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/abilityinterfacesappmanageramsmgrstubsecond_fuzzer.cpp +++ b/test/fuzztest/abilityinterfacesappmanageramsmgrstubsecond_fuzzer/abilityinterfacesappmanageramsmgrstubsecond_fuzzer.cpp @@ -24,35 +24,14 @@ #include "ams_mgr_scheduler.h" #undef private -#include "securec.h" -#include "parcel.h" -#include "ability_record.h" - using namespace OHOS::AAFwk; using namespace OHOS::AppExecFwk; namespace OHOS { namespace { -constexpr int INPUT_ZERO = 0; -constexpr int INPUT_ONE = 1; -constexpr int INPUT_TWO = 2; -constexpr int INPUT_THREE = 3; -constexpr size_t U32_AT_SIZE = 4; -constexpr size_t OFFSET_ZERO = 24; -constexpr size_t OFFSET_ONE = 16; -constexpr size_t OFFSET_TWO = 8; -constexpr uint8_t ENABLE = 2; constexpr size_t STRING_MAX_LENGTH = 128; } - const std::u16string AMSMGR_INTERFACE_TOKEN = u"ohos.appexecfwk.IAmsMgr"; -uint32_t GetU32Data(const char* ptr) -{ - // convert fuzz input data to an integer - return (ptr[INPUT_ZERO] << OFFSET_ZERO) | (ptr[INPUT_ONE] << OFFSET_ONE) | (ptr[INPUT_TWO] << OFFSET_TWO) | - ptr[INPUT_THREE]; -} - bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { std::shared_ptr MgrServiceInner; -- Gitee