Signed-off-by: lovechinamo <wangdongqi2@huawei.com>

Changes to be committed:
This commit is contained in:
lovechinamo 2022-05-25 10:44:21 +08:00
parent 157a204bd6
commit 68d15e6556
3 changed files with 7 additions and 8 deletions

View File

@ -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",

View File

@ -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;

View File

@ -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