From 3afb5e4f2f0235f711abf63102075d31c6842a32 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Tue, 24 May 2022 11:06:40 +0800 Subject: [PATCH 1/8] Signed-off-by: lovechinamo Changes to be committed: --- bundle.json | 3 +- test/fuzztest/BUILD.gn | 22 ++++++ test/fuzztest/inputclientstub_fuzzer/BUILD.gn | 61 ++++++++++++++++ .../inputclientstub_fuzzer/corpus/init | 1 + .../inputclientstub_fuzzer.cpp | 70 +++++++++++++++++++ .../inputclientstub_fuzzer.h | 21 ++++++ .../inputclientstub_fuzzer/project.xml | 25 +++++++ 7 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 test/fuzztest/BUILD.gn create mode 100644 test/fuzztest/inputclientstub_fuzzer/BUILD.gn create mode 100644 test/fuzztest/inputclientstub_fuzzer/corpus/init create mode 100644 test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.cpp create mode 100644 test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.h create mode 100644 test/fuzztest/inputclientstub_fuzzer/project.xml diff --git a/bundle.json b/bundle.json index 5a45d46..e30bbde 100644 --- a/bundle.json +++ b/bundle.json @@ -131,7 +131,8 @@ ], "test": [ "//base/miscservices/inputmethod/unitest:InputMethodControllerTest", - "//base/miscservices/inputmethod/unitest:InputMethodAbilityTest" + "//base/miscservices/inputmethod/unitest:InputMethodAbilityTest", + "//base/miscservices/inputmethod/test/fuzztest:fuzztest" ] } } diff --git a/test/fuzztest/BUILD.gn b/test/fuzztest/BUILD.gn new file mode 100644 index 0000000..758d883 --- /dev/null +++ b/test/fuzztest/BUILD.gn @@ -0,0 +1,22 @@ +# 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. + +import("//base/miscservices/inputmethod/inputmethod.gni") + +group("fuzztest") { + testonly = true + + deps = [ + "inputclientstub_fuzzer:fuzztest", + ] +} diff --git a/test/fuzztest/inputclientstub_fuzzer/BUILD.gn b/test/fuzztest/inputclientstub_fuzzer/BUILD.gn new file mode 100644 index 0000000..9fa4083 --- /dev/null +++ b/test/fuzztest/inputclientstub_fuzzer/BUILD.gn @@ -0,0 +1,61 @@ +# Copyright (c) 2021 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") + +##############################fuzztest########################################## +ohos_fuzztest("InputClientStubFuzzTest") { + +module_out_path = "miscservices/inputmethod" + +fuzz_config_file = "//base/miscservices/inputmethod/test/fuzztest/inputclientstub_fuzzer" + +include_dirs = ["//base/miscservices/inputmethod/frameworks/inputmethod_controller/include", + "//base/miscservices/inputmethod/frameworks/inputmethod_controller/src", + "//base/miscservices/inputmethod/frameworks/inputmethod_ability/include", + "//base/miscservices/inputmethod/services/include", + "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", + "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", + "//foundation/multimodalinput/input/interfaces/native/innerkits/event/include", + "//utils/native/base/include",] + +cflags = ["-g","-O0","-Wno-unused-variable","-fno-omit-frame-pointer"] + +sources = [ "inputclientstub_fuzzer.cpp"] + +deps = [ + "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", + "//foundation/communication/ipc/interfaces/innerkits/ipc_single:ipc_single", + "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk", + "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", + "//foundation/multimodalinput/input/frameworks/proxy:libmmi-common", + "//utils/native/base:utils", + "//base/miscservices/inputmethod/services:inputmethod_service", + "//base/miscservices/inputmethod/frameworks/inputmethod_controller:inputmethod_client", + ] + +external_deps = [ "hiviewdfx_hilog_native:libhilog",] +} +############################################################################### +group("fuzztest") { + testonly = true + deps = [] + deps += [ + # deps file + ":InputClientStubFuzzTest", + ] +} +############################################################################### diff --git a/test/fuzztest/inputclientstub_fuzzer/corpus/init b/test/fuzztest/inputclientstub_fuzzer/corpus/init new file mode 100644 index 0000000..6b7212c --- /dev/null +++ b/test/fuzztest/inputclientstub_fuzzer/corpus/init @@ -0,0 +1 @@ +FUZZ \ No newline at end of file diff --git a/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.cpp b/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.cpp new file mode 100644 index 0000000..f762dd3 --- /dev/null +++ b/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2021 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 +#include + +#include "inputclientstub_fuzzer.h" +#include "input_client_stub.h" +#include "global.h" + +#include "message_parcel.h" + +using namespace OHOS::MiscServices; +namespace OHOS { + constexpr size_t THRESHOLD = 10; + constexpr int32_t OFFSET = 4; + const std::u16string ICS_INTERFACE_TOKEN = u"ohos.miscservices.InputClientStub"; + + uint32_t ConvertToUint32(const uint8_t *ptr) + { + if (ptr == nullptr) + { + return 0; + } + return (ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | (ptr[3]); + } + bool FuzzInputClientStub(const uint8_t* rawData, size_t size) + { + uint32_t code = ConvertToUint32(rawData); + rawData = rawData + OFFSET; + size = size - OFFSET; + + MessageParcel data; + data.WriteInterfaceToken(ICS_INTERFACE_TOKEN); + data.WriteBuffer(rawData, size); + data.RewindRead(0); + MessageParcel reply; + MessageOption option; + + sptr mClient = new InputClientStub; + mClient->OnRemoteRequest(code, data, reply, option); + + return true; + } +} +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + if (size < OHOS::THRESHOLD) + { + return -1; + } + /* Run your code on data */ + OHOS::FuzzInputClientStub(data, size); + return 0; +} + diff --git a/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.h b/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.h new file mode 100644 index 0000000..4322bc5 --- /dev/null +++ b/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2021 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 TEST_FUZZTEST_ICS_FUZZER_ICS_FUZZER_H +#define TEST_FUZZTEST_ICS_FUZZER_ICS_FUZZER_H + +#define FUZZ_PROJECT_NAME "inputclientstub_fuzzer" + +#endif // TEST_FUZZTEST_ICS_FUZZER_ICS_FUZZER_H diff --git a/test/fuzztest/inputclientstub_fuzzer/project.xml b/test/fuzztest/inputclientstub_fuzzer/project.xml new file mode 100644 index 0000000..85e7ef2 --- /dev/null +++ b/test/fuzztest/inputclientstub_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + From 6c8e27c084b8d484516cdeb0a85f85eaaab5954c Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Tue, 24 May 2022 14:46:58 +0800 Subject: [PATCH 2/8] Signed-off-by: lovechinamo Changes to be committed: --- test/fuzztest/inputclientstub_fuzzer/corpus/init | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/fuzztest/inputclientstub_fuzzer/corpus/init b/test/fuzztest/inputclientstub_fuzzer/corpus/init index 6b7212c..bc977bd 100644 --- a/test/fuzztest/inputclientstub_fuzzer/corpus/init +++ b/test/fuzztest/inputclientstub_fuzzer/corpus/init @@ -1 +1,14 @@ +# 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 \ No newline at end of file From fe21412957c84c2301ecabafd00b245aec5566a6 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Tue, 24 May 2022 15:42:36 +0800 Subject: [PATCH 3/8] Signed-off-by: lovechinamo Changes to be committed: --- .../inputclientstub_fuzzer.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.cpp b/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.cpp index f762dd3..33d02fe 100644 --- a/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.cpp +++ b/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.cpp @@ -14,10 +14,11 @@ */ -#include -#include - #include "inputclientstub_fuzzer.h" + +#include +#include + #include "input_client_stub.h" #include "global.h" @@ -31,11 +32,11 @@ namespace OHOS { uint32_t ConvertToUint32(const uint8_t *ptr) { - if (ptr == nullptr) - { + if (ptr == nullptr) { return 0; } - return (ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | (ptr[3]); + uint32_t bigvar = (ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | (ptr[3]); + return bigvar; } bool FuzzInputClientStub(const uint8_t* rawData, size_t size) { @@ -59,8 +60,7 @@ namespace OHOS { /* Fuzzer entry point */ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { - if (size < OHOS::THRESHOLD) - { + if (size < OHOS::THRESHOLD) { return -1; } /* Run your code on data */ From 9a32f2053626b962af9f45ba00e5436737aeef21 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Tue, 24 May 2022 15:54:33 +0800 Subject: [PATCH 4/8] Signed-off-by: lovechinamo Changes to be committed: --- test/fuzztest/BUILD.gn | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/fuzztest/BUILD.gn b/test/fuzztest/BUILD.gn index 758d883..0e73327 100644 --- a/test/fuzztest/BUILD.gn +++ b/test/fuzztest/BUILD.gn @@ -16,7 +16,5 @@ import("//base/miscservices/inputmethod/inputmethod.gni") group("fuzztest") { testonly = true - deps = [ - "inputclientstub_fuzzer:fuzztest", - ] + deps = [ "inputclientstub_fuzzer:fuzztest" ] } From 8950476f8b11d614ba172e4d8523b96a05e6fbd0 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Tue, 24 May 2022 16:15:39 +0800 Subject: [PATCH 5/8] Signed-off-by: lovechinamo Changes to be committed: --- test/fuzztest/inputclientstub_fuzzer/BUILD.gn | 61 +++++++++++-------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/test/fuzztest/inputclientstub_fuzzer/BUILD.gn b/test/fuzztest/inputclientstub_fuzzer/BUILD.gn index 9fa4083..db1ae6a 100644 --- a/test/fuzztest/inputclientstub_fuzzer/BUILD.gn +++ b/test/fuzztest/inputclientstub_fuzzer/BUILD.gn @@ -13,41 +13,54 @@ #####################hydra-fuzz################### import("//build/config/features.gni") -import("//build/ohos.gni") import("//build/test.gni") +import("//build/ohos.gni") +import("//base/miscservices/pasteboard/pasteboard.gni") +import("//foundation/aafwk/standard/aafwk.gni") ##############################fuzztest########################################## -ohos_fuzztest("InputClientStubFuzzTest") { +ohos_fuzztest("PasteboardServiceFuzzTest") { -module_out_path = "miscservices/inputmethod" +module_out_path = "miscservices/pasteboard" -fuzz_config_file = "//base/miscservices/inputmethod/test/fuzztest/inputclientstub_fuzzer" +fuzz_config_file = "//base/miscservices/pasteboard/test/fuzztest/pasteboardservice_fuzzer" + +configs = [ "//base/miscservices/pasteboard/services:pasteboard_service_config" ] + +include_dirs = [ "//base/miscservices/pasteboard/services/zidl/include", + "//base/miscservices/pasteboard/services/zidl/src", + "//base/miscservices/pasteboard/services/core/include", + "${pasteboard_innerkits_path}/include", + "//utils/system/safwk/native/include", + "//third_party/json/include", + "${pasteboard_utils_path}/mock/include", + "${pasteboard_utils_path}/native/include", + "//foundation/aafwk/standard/ability_base/interfaces/inner_api/uri/include", + "//foundation/aafwk/standard/ability_base/interfaces/inner_api/want/include", + "//foundation/aafwk/standard/ability_base/interfaces/inner_api/base/include", + ] -include_dirs = ["//base/miscservices/inputmethod/frameworks/inputmethod_controller/include", - "//base/miscservices/inputmethod/frameworks/inputmethod_controller/src", - "//base/miscservices/inputmethod/frameworks/inputmethod_ability/include", - "//base/miscservices/inputmethod/services/include", - "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", - "//foundation/multimodalinput/input/interfaces/native/innerkits/event/include", - "//utils/native/base/include",] - cflags = ["-g","-O0","-Wno-unused-variable","-fno-omit-frame-pointer"] -sources = [ "inputclientstub_fuzzer.cpp"] +sources = [ "pasteboardservice_fuzzer.cpp",] deps = [ - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", - "//foundation/communication/ipc/interfaces/innerkits/ipc_single:ipc_single", - "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk", - "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", - "//foundation/multimodalinput/input/frameworks/proxy:libmmi-common", - "//utils/native/base:utils", - "//base/miscservices/inputmethod/services:inputmethod_service", - "//base/miscservices/inputmethod/frameworks/inputmethod_controller:inputmethod_client", + "${pasteboard_innerkits_path}:pasteboard_client", + "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native", + "//third_party/jsoncpp:jsoncpp", + "//utils/native/base:utils", + "//base/miscservices/pasteboard/services:pasteboard_service", ] -external_deps = [ "hiviewdfx_hilog_native:libhilog",] +external_deps = [ "hiviewdfx_hilog_native:libhilog", + "ability_base:want", + "eventhandler:libeventhandler", + "hisysevent_native:libhisysevent", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr_standard:samgr_proxy", + "common_event_service:cesfwk_innerkits",] } ############################################################################### group("fuzztest") { @@ -55,7 +68,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - ":InputClientStubFuzzTest", + ":PasteboardServiceFuzzTest", ] } ############################################################################### From e7d4de3f134647101d5c499c43b81c6677fd344c Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Tue, 24 May 2022 16:24:59 +0800 Subject: [PATCH 6/8] Signed-off-by: lovechinamo Changes to be committed: --- test/fuzztest/inputclientstub_fuzzer/BUILD.gn | 77 +++++++++---------- 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/test/fuzztest/inputclientstub_fuzzer/BUILD.gn b/test/fuzztest/inputclientstub_fuzzer/BUILD.gn index db1ae6a..f69e5af 100644 --- a/test/fuzztest/inputclientstub_fuzzer/BUILD.gn +++ b/test/fuzztest/inputclientstub_fuzzer/BUILD.gn @@ -11,64 +11,61 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/miscservices/inputmethod/inputmethod.gni") + #####################hydra-fuzz################### import("//build/config/features.gni") -import("//build/test.gni") import("//build/ohos.gni") -import("//base/miscservices/pasteboard/pasteboard.gni") -import("//foundation/aafwk/standard/aafwk.gni") +import("//build/test.gni") ##############################fuzztest########################################## -ohos_fuzztest("PasteboardServiceFuzzTest") { +ohos_fuzztest("InputClientStubFuzzTest") { + module_out_path = "miscservices/inputmethod" -module_out_path = "miscservices/pasteboard" + fuzz_config_file = + "//base/miscservices/inputmethod/test/fuzztest/inputclientstub_fuzzer" -fuzz_config_file = "//base/miscservices/pasteboard/test/fuzztest/pasteboardservice_fuzzer" + include_dirs = [ + "//base/miscservices/inputmethod/frameworks/inputmethod_controller/include", + "//base/miscservices/inputmethod/frameworks/inputmethod_controller/src", + "//base/miscservices/inputmethod/frameworks/inputmethod_ability/include", + "//base/miscservices/inputmethod/services/include", + "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", + "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", + "//foundation/multimodalinput/input/interfaces/native/innerkits/event/include", + "//utils/native/base/include", + ] -configs = [ "//base/miscservices/pasteboard/services:pasteboard_service_config" ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] -include_dirs = [ "//base/miscservices/pasteboard/services/zidl/include", - "//base/miscservices/pasteboard/services/zidl/src", - "//base/miscservices/pasteboard/services/core/include", - "${pasteboard_innerkits_path}/include", - "//utils/system/safwk/native/include", - "//third_party/json/include", - "${pasteboard_utils_path}/mock/include", - "${pasteboard_utils_path}/native/include", - "//foundation/aafwk/standard/ability_base/interfaces/inner_api/uri/include", - "//foundation/aafwk/standard/ability_base/interfaces/inner_api/want/include", - "//foundation/aafwk/standard/ability_base/interfaces/inner_api/base/include", - ] + sources = [ "inputclientstub_fuzzer.cpp" ] -cflags = ["-g","-O0","-Wno-unused-variable","-fno-omit-frame-pointer"] - -sources = [ "pasteboardservice_fuzzer.cpp",] + deps = [ + "//base/miscservices/inputmethod/frameworks/inputmethod_controller:inputmethod_client", + "//base/miscservices/inputmethod/services:inputmethod_service", + "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", + "//foundation/communication/ipc/interfaces/innerkits/ipc_single:ipc_single", + "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk", + "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", + "//foundation/multimodalinput/input/frameworks/proxy:libmmi-common", + "//utils/native/base:utils", + ] -deps = [ - "${pasteboard_innerkits_path}:pasteboard_client", - "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native", - "//third_party/jsoncpp:jsoncpp", - "//utils/native/base:utils", - "//base/miscservices/pasteboard/services:pasteboard_service", - ] - -external_deps = [ "hiviewdfx_hilog_native:libhilog", - "ability_base:want", - "eventhandler:libeventhandler", - "hisysevent_native:libhisysevent", - "hiviewdfx_hilog_native:libhilog", - "ipc:ipc_core", - "safwk:system_ability_fwk", - "samgr_standard:samgr_proxy", - "common_event_service:cesfwk_innerkits",] + external_deps = [ "hiviewdfx_hilog_native:libhilog" ] } + ############################################################################### group("fuzztest") { testonly = true deps = [] deps += [ # deps file - ":PasteboardServiceFuzzTest", + ":InputClientStubFuzzTest", ] } ############################################################################### From 7698e25f6152e549171f39f4bf64b508f4cf3d99 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Wed, 25 May 2022 10:44:21 +0800 Subject: [PATCH 7/8] Signed-off-by: lovechinamo Changes to be committed: --- test/fuzztest/inputclientstub_fuzzer/BUILD.gn | 1 - .../inputclientstub_fuzzer/inputclientstub_fuzzer.cpp | 8 ++++---- .../inputclientstub_fuzzer/inputclientstub_fuzzer.h | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/test/fuzztest/inputclientstub_fuzzer/BUILD.gn b/test/fuzztest/inputclientstub_fuzzer/BUILD.gn index f69e5af..9d7340d 100644 --- a/test/fuzztest/inputclientstub_fuzzer/BUILD.gn +++ b/test/fuzztest/inputclientstub_fuzzer/BUILD.gn @@ -27,7 +27,6 @@ ohos_fuzztest("InputClientStubFuzzTest") { include_dirs = [ "//base/miscservices/inputmethod/frameworks/inputmethod_controller/include", - "//base/miscservices/inputmethod/frameworks/inputmethod_controller/src", "//base/miscservices/inputmethod/frameworks/inputmethod_ability/include", "//base/miscservices/inputmethod/services/include", "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", diff --git a/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.cpp b/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.cpp index 33d02fe..5fad1f8 100644 --- a/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.cpp +++ b/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.cpp @@ -28,15 +28,15 @@ using namespace OHOS::MiscServices; namespace OHOS { constexpr size_t THRESHOLD = 10; constexpr int32_t OFFSET = 4; - const std::u16string ICS_INTERFACE_TOKEN = u"ohos.miscservices.InputClientStub"; + const std::u16string INPUTCLIENTSTUB_INTERFACE_TOKEN = u"ohos.miscservices.InputClientStub"; uint32_t ConvertToUint32(const uint8_t *ptr) { if (ptr == nullptr) { return 0; } - uint32_t bigvar = (ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | (ptr[3]); - return bigvar; + uint32_t bigVar = (ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | (ptr[3]); + return bigVar; } bool FuzzInputClientStub(const uint8_t* rawData, size_t size) { @@ -45,7 +45,7 @@ namespace OHOS { size = size - OFFSET; MessageParcel data; - data.WriteInterfaceToken(ICS_INTERFACE_TOKEN); + data.WriteInterfaceToken(INPUTCLIENTSTUB_INTERFACE_TOKEN); data.WriteBuffer(rawData, size); data.RewindRead(0); MessageParcel reply; diff --git a/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.h b/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.h index 4322bc5..4acd32e 100644 --- a/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.h +++ b/test/fuzztest/inputclientstub_fuzzer/inputclientstub_fuzzer.h @@ -13,9 +13,9 @@ * limitations under the License. */ -#ifndef TEST_FUZZTEST_ICS_FUZZER_ICS_FUZZER_H -#define TEST_FUZZTEST_ICS_FUZZER_ICS_FUZZER_H +#ifndef TEST_FUZZTEST_INPUTCLIENTSTUB_FUZZER_INPUTCLIENTSTUB_FUZZER_H +#define TEST_FUZZTEST_INPUTCLIENTSTUB_FUZZER_INPUTCLIENTSTUB_FUZZER_H #define FUZZ_PROJECT_NAME "inputclientstub_fuzzer" -#endif // TEST_FUZZTEST_ICS_FUZZER_ICS_FUZZER_H +#endif // TEST_FUZZTEST_INPUTCLIENTSTUB_FUZZER_INPUTCLIENTSTUB_FUZZER_H From 97b3c9831cef49067d2ead71b907a73e434ff432 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Wed, 25 May 2022 16:41:22 +0800 Subject: [PATCH 8/8] Signed-off-by: lovechinamo Changes to be committed: --- test/fuzztest/inputclientstub_fuzzer/BUILD.gn | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/fuzztest/inputclientstub_fuzzer/BUILD.gn b/test/fuzztest/inputclientstub_fuzzer/BUILD.gn index 9d7340d..a700632 100644 --- a/test/fuzztest/inputclientstub_fuzzer/BUILD.gn +++ b/test/fuzztest/inputclientstub_fuzzer/BUILD.gn @@ -31,7 +31,6 @@ ohos_fuzztest("InputClientStubFuzzTest") { "//base/miscservices/inputmethod/services/include", "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", - "//foundation/multimodalinput/input/interfaces/native/innerkits/event/include", "//utils/native/base/include", ] @@ -51,7 +50,6 @@ ohos_fuzztest("InputClientStubFuzzTest") { "//foundation/communication/ipc/interfaces/innerkits/ipc_single:ipc_single", "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk", "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", - "//foundation/multimodalinput/input/frameworks/proxy:libmmi-common", "//utils/native/base:utils", ]