From 655969f1e4869e433cad070fffffa9640ae879f3 Mon Sep 17 00:00:00 2001 From: bigtea Date: Wed, 20 Aug 2025 15:02:23 +0800 Subject: [PATCH] Fix incorrect use of fuzz size 6.0 --- .../main/cpp/src/token/accesstoken_info_manager.cpp | 1 - .../allochaptokenservice_fuzzer.cpp | 2 +- .../gethaptokenidservice_fuzzer.cpp | 2 +- .../gethaptokeninfoservice_fuzzer.cpp | 2 +- .../getnativetokenidservice_fuzzer.cpp | 2 +- .../getnativetokeninfoservice_fuzzer.cpp | 2 +- .../getpermissionflagservice_fuzzer.cpp | 2 +- .../inithaptokenservice_fuzzer.cpp | 2 +- .../revokepermissionservice_fuzzer.cpp | 2 +- .../allochaptokenstub_fuzzer/allochaptokenstub_fuzzer.cpp | 2 +- .../alloclocaltokenidstub_fuzzer.cpp | 2 +- .../clearusergrantedpermissionstatestub_fuzzer.cpp | 2 +- .../deleteremotedevicetokensstub_fuzzer.cpp | 2 +- .../deleteremotetokenstub_fuzzer.cpp | 2 +- .../deletetokenstub_fuzzer/deletetokenstub_fuzzer.cpp | 2 +- .../gethaptokenidstub_fuzzer/gethaptokenidstub_fuzzer.cpp | 2 +- .../gethaptokeninfoextstub_fuzzer.cpp | 6 ++++-- .../gethaptokeninfofromremotestub_fuzzer.cpp | 2 +- .../gethaptokeninfostub_fuzzer.cpp | 2 +- .../getnativetokenidstub_fuzzer.cpp | 2 +- .../getnativetokeninfostub_fuzzer.cpp | 2 +- .../getpermissionflagstub_fuzzer.cpp | 2 +- .../getpermissionrequesttogglestatusstub_fuzzer.cpp | 2 +- .../getpermissionsstatusstub_fuzzer.cpp | 2 +- .../getpermissionusedtypestub_fuzzer.cpp | 2 +- .../getremotenativetokenidstub_fuzzer.cpp | 2 +- .../grantpermissionforspecifiedtimestub_fuzzer.cpp | 2 +- .../grantpermissionstub_fuzzer.cpp | 4 ++-- .../inithaptokenstub_fuzzer/inithaptokenstub_fuzzer.cpp | 2 +- .../inituserpolicystub_fuzzer/inituserpolicystub_fuzzer.cpp | 2 +- .../registerselfpermstatechangecallbackstub_fuzzer.cpp | 2 +- .../revokepermissionstub_fuzzer.cpp | 2 +- .../setpermissionrequesttogglestatusstub_fuzzer.cpp | 2 +- .../setremotehaptokeninfostub_fuzzer.cpp | 2 +- .../updatehaptokenstub_fuzzer/updatehaptokenstub_fuzzer.cpp | 2 +- .../updateuserpolicystub_fuzzer.cpp | 2 +- .../getpermissionusedrecordtogglestatusstub_fuzzer.cpp | 2 +- .../sethapwithfgreminderstub_fuzzer.cpp | 2 +- .../setmutepolicystub_fuzzer/setmutepolicystub_fuzzer.cpp | 2 +- .../setpermissionusedrecordtogglestatusstub_fuzzer.cpp | 2 +- 40 files changed, 43 insertions(+), 42 deletions(-) diff --git a/services/accesstokenmanager/main/cpp/src/token/accesstoken_info_manager.cpp b/services/accesstokenmanager/main/cpp/src/token/accesstoken_info_manager.cpp index d0569f0fd..4ef1b4c05 100644 --- a/services/accesstokenmanager/main/cpp/src/token/accesstoken_info_manager.cpp +++ b/services/accesstokenmanager/main/cpp/src/token/accesstoken_info_manager.cpp @@ -1778,7 +1778,6 @@ int32_t AccessTokenInfoManager::SetPermissionRequestToggleStatus(const std::stri int32_t ret = AddPermRequestToggleStatusToDb(userID, permissionName, status); if (ret != RET_SUCCESS) { - LOGE(ATM_DOMAIN, ATM_TAG, "Status is invalid."); return ret; } diff --git a/test/fuzztest/normalize_service/accesstoken/allochaptokenservice_fuzzer/allochaptokenservice_fuzzer.cpp b/test/fuzztest/normalize_service/accesstoken/allochaptokenservice_fuzzer/allochaptokenservice_fuzzer.cpp index d6f7ff8f4..a0f470301 100644 --- a/test/fuzztest/normalize_service/accesstoken/allochaptokenservice_fuzzer/allochaptokenservice_fuzzer.cpp +++ b/test/fuzztest/normalize_service/accesstoken/allochaptokenservice_fuzzer/allochaptokenservice_fuzzer.cpp @@ -122,7 +122,7 @@ bool AllocHapTokenServiceFuzzTest(const uint8_t* data, size_t size) MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TEN) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TEN) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TEN); } diff --git a/test/fuzztest/normalize_service/accesstoken/gethaptokenidservice_fuzzer/gethaptokenidservice_fuzzer.cpp b/test/fuzztest/normalize_service/accesstoken/gethaptokenidservice_fuzzer/gethaptokenidservice_fuzzer.cpp index 6e039068b..594a66c56 100644 --- a/test/fuzztest/normalize_service/accesstoken/gethaptokenidservice_fuzzer/gethaptokenidservice_fuzzer.cpp +++ b/test/fuzztest/normalize_service/accesstoken/gethaptokenidservice_fuzzer/gethaptokenidservice_fuzzer.cpp @@ -49,7 +49,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TEN) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TEN) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TEN); } diff --git a/test/fuzztest/normalize_service/accesstoken/gethaptokeninfoservice_fuzzer/gethaptokeninfoservice_fuzzer.cpp b/test/fuzztest/normalize_service/accesstoken/gethaptokeninfoservice_fuzzer/gethaptokeninfoservice_fuzzer.cpp index c1083eab9..dc9307835 100644 --- a/test/fuzztest/normalize_service/accesstoken/gethaptokeninfoservice_fuzzer/gethaptokeninfoservice_fuzzer.cpp +++ b/test/fuzztest/normalize_service/accesstoken/gethaptokeninfoservice_fuzzer/gethaptokeninfoservice_fuzzer.cpp @@ -46,7 +46,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TEN) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TEN) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TEN); } diff --git a/test/fuzztest/normalize_service/accesstoken/getnativetokenidservice_fuzzer/getnativetokenidservice_fuzzer.cpp b/test/fuzztest/normalize_service/accesstoken/getnativetokenidservice_fuzzer/getnativetokenidservice_fuzzer.cpp index 049f197f8..264b48511 100644 --- a/test/fuzztest/normalize_service/accesstoken/getnativetokenidservice_fuzzer/getnativetokenidservice_fuzzer.cpp +++ b/test/fuzztest/normalize_service/accesstoken/getnativetokenidservice_fuzzer/getnativetokenidservice_fuzzer.cpp @@ -58,7 +58,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TEN) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TEN) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TEN); } diff --git a/test/fuzztest/normalize_service/accesstoken/getnativetokeninfoservice_fuzzer/getnativetokeninfoservice_fuzzer.cpp b/test/fuzztest/normalize_service/accesstoken/getnativetokeninfoservice_fuzzer/getnativetokeninfoservice_fuzzer.cpp index 235ac7e3a..1da6e0305 100644 --- a/test/fuzztest/normalize_service/accesstoken/getnativetokeninfoservice_fuzzer/getnativetokeninfoservice_fuzzer.cpp +++ b/test/fuzztest/normalize_service/accesstoken/getnativetokeninfoservice_fuzzer/getnativetokeninfoservice_fuzzer.cpp @@ -56,7 +56,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TEN) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TEN) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TEN); } diff --git a/test/fuzztest/normalize_service/accesstoken/getpermissionflagservice_fuzzer/getpermissionflagservice_fuzzer.cpp b/test/fuzztest/normalize_service/accesstoken/getpermissionflagservice_fuzzer/getpermissionflagservice_fuzzer.cpp index f0176436b..b96edd3fb 100644 --- a/test/fuzztest/normalize_service/accesstoken/getpermissionflagservice_fuzzer/getpermissionflagservice_fuzzer.cpp +++ b/test/fuzztest/normalize_service/accesstoken/getpermissionflagservice_fuzzer/getpermissionflagservice_fuzzer.cpp @@ -52,7 +52,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TEN) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TEN) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TEN); } diff --git a/test/fuzztest/normalize_service/accesstoken/inithaptokenservice_fuzzer/inithaptokenservice_fuzzer.cpp b/test/fuzztest/normalize_service/accesstoken/inithaptokenservice_fuzzer/inithaptokenservice_fuzzer.cpp index 2b2267bb4..23c502e95 100644 --- a/test/fuzztest/normalize_service/accesstoken/inithaptokenservice_fuzzer/inithaptokenservice_fuzzer.cpp +++ b/test/fuzztest/normalize_service/accesstoken/inithaptokenservice_fuzzer/inithaptokenservice_fuzzer.cpp @@ -122,7 +122,7 @@ bool InitHapTokenServiceFuzzTest(const uint8_t* data, size_t size) MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TEN) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TEN) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TEN); } diff --git a/test/fuzztest/normalize_service/accesstoken/revokepermissionservice_fuzzer/revokepermissionservice_fuzzer.cpp b/test/fuzztest/normalize_service/accesstoken/revokepermissionservice_fuzzer/revokepermissionservice_fuzzer.cpp index 30e899678..eefc29c51 100644 --- a/test/fuzztest/normalize_service/accesstoken/revokepermissionservice_fuzzer/revokepermissionservice_fuzzer.cpp +++ b/test/fuzztest/normalize_service/accesstoken/revokepermissionservice_fuzzer/revokepermissionservice_fuzzer.cpp @@ -66,7 +66,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TEN) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TEN) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TEN); } diff --git a/test/fuzztest/services/accesstoken/allochaptokenstub_fuzzer/allochaptokenstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/allochaptokenstub_fuzzer/allochaptokenstub_fuzzer.cpp index 7fa2f6742..10ea73663 100644 --- a/test/fuzztest/services/accesstoken/allochaptokenstub_fuzzer/allochaptokenstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/allochaptokenstub_fuzzer/allochaptokenstub_fuzzer.cpp @@ -123,7 +123,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/alloclocaltokenidstub_fuzzer/alloclocaltokenidstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/alloclocaltokenidstub_fuzzer/alloclocaltokenidstub_fuzzer.cpp index 8039d7232..98c769efe 100644 --- a/test/fuzztest/services/accesstoken/alloclocaltokenidstub_fuzzer/alloclocaltokenidstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/alloclocaltokenidstub_fuzzer/alloclocaltokenidstub_fuzzer.cpp @@ -53,7 +53,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/clearusergrantedpermissionstatestub_fuzzer/clearusergrantedpermissionstatestub_fuzzer.cpp b/test/fuzztest/services/accesstoken/clearusergrantedpermissionstatestub_fuzzer/clearusergrantedpermissionstatestub_fuzzer.cpp index 32492574a..1fa95d9a6 100644 --- a/test/fuzztest/services/accesstoken/clearusergrantedpermissionstatestub_fuzzer/clearusergrantedpermissionstatestub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/clearusergrantedpermissionstatestub_fuzzer/clearusergrantedpermissionstatestub_fuzzer.cpp @@ -51,7 +51,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/deleteremotedevicetokensstub_fuzzer/deleteremotedevicetokensstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/deleteremotedevicetokensstub_fuzzer/deleteremotedevicetokensstub_fuzzer.cpp index 35de2db22..061b7cb10 100644 --- a/test/fuzztest/services/accesstoken/deleteremotedevicetokensstub_fuzzer/deleteremotedevicetokensstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/deleteremotedevicetokensstub_fuzzer/deleteremotedevicetokensstub_fuzzer.cpp @@ -55,7 +55,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { AccessTokenID accesstoken = AccessTokenKit::GetNativeTokenId("token_sync_service"); SetSelfTokenID(accesstoken); diff --git a/test/fuzztest/services/accesstoken/deleteremotetokenstub_fuzzer/deleteremotetokenstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/deleteremotetokenstub_fuzzer/deleteremotetokenstub_fuzzer.cpp index e9af186c9..37ab57ac3 100644 --- a/test/fuzztest/services/accesstoken/deleteremotetokenstub_fuzzer/deleteremotetokenstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/deleteremotetokenstub_fuzzer/deleteremotetokenstub_fuzzer.cpp @@ -59,7 +59,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { AccessTokenID accesstoken = AccessTokenKit::GetNativeTokenId("token_sync_service"); SetSelfTokenID(accesstoken); diff --git a/test/fuzztest/services/accesstoken/deletetokenstub_fuzzer/deletetokenstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/deletetokenstub_fuzzer/deletetokenstub_fuzzer.cpp index faea9dcf8..0598193fe 100644 --- a/test/fuzztest/services/accesstoken/deletetokenstub_fuzzer/deletetokenstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/deletetokenstub_fuzzer/deletetokenstub_fuzzer.cpp @@ -52,7 +52,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/gethaptokenidstub_fuzzer/gethaptokenidstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/gethaptokenidstub_fuzzer/gethaptokenidstub_fuzzer.cpp index 137dcbcf9..6de4ea48d 100644 --- a/test/fuzztest/services/accesstoken/gethaptokenidstub_fuzzer/gethaptokenidstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/gethaptokenidstub_fuzzer/gethaptokenidstub_fuzzer.cpp @@ -54,7 +54,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/gethaptokeninfoextstub_fuzzer/gethaptokeninfoextstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/gethaptokeninfoextstub_fuzzer/gethaptokeninfoextstub_fuzzer.cpp index 1f6b07eb3..af1ae0d94 100644 --- a/test/fuzztest/services/accesstoken/gethaptokeninfoextstub_fuzzer/gethaptokeninfoextstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/gethaptokeninfoextstub_fuzzer/gethaptokeninfoextstub_fuzzer.cpp @@ -24,6 +24,7 @@ #undef private #include "accesstoken_fuzzdata.h" #include "accesstoken_manager_service.h" +#include "fuzzer/FuzzedDataProvider.h" #include "iaccess_token_manager.h" #include "permission_def_parcel.h" #include "accesstoken_kit.h" @@ -121,7 +122,8 @@ namespace OHOS { SetHapTokenInfo(); AccessTokenFuzzData fuzzData(data, size); AccessTokenID tokenId = 0; - if (size % CONSTANTS_NUMBER_FIVE == 0) { + FuzzedDataProvider provider(data, size); + if ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_FIVE) == 0) { tokenId = AccessTokenKit::GetHapTokenID(TEST_USER_ID, TEST_BUNDLE_NAME, 0); } else { tokenId = fuzzData.GetData(); @@ -138,7 +140,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/gethaptokeninfofromremotestub_fuzzer/gethaptokeninfofromremotestub_fuzzer.cpp b/test/fuzztest/services/accesstoken/gethaptokeninfofromremotestub_fuzzer/gethaptokeninfofromremotestub_fuzzer.cpp index 33a054910..75908ff58 100644 --- a/test/fuzztest/services/accesstoken/gethaptokeninfofromremotestub_fuzzer/gethaptokeninfofromremotestub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/gethaptokeninfofromremotestub_fuzzer/gethaptokeninfofromremotestub_fuzzer.cpp @@ -55,7 +55,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { AccessTokenID accesstoken = AccessTokenKit::GetNativeTokenId("token_sync_service"); SetSelfTokenID(accesstoken); diff --git a/test/fuzztest/services/accesstoken/gethaptokeninfostub_fuzzer/gethaptokeninfostub_fuzzer.cpp b/test/fuzztest/services/accesstoken/gethaptokeninfostub_fuzzer/gethaptokeninfostub_fuzzer.cpp index 3bb6219a2..9d1480999 100644 --- a/test/fuzztest/services/accesstoken/gethaptokeninfostub_fuzzer/gethaptokeninfostub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/gethaptokeninfostub_fuzzer/gethaptokeninfostub_fuzzer.cpp @@ -46,7 +46,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/getnativetokenidstub_fuzzer/getnativetokenidstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/getnativetokenidstub_fuzzer/getnativetokenidstub_fuzzer.cpp index 1f624fe38..81c323269 100644 --- a/test/fuzztest/services/accesstoken/getnativetokenidstub_fuzzer/getnativetokenidstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/getnativetokenidstub_fuzzer/getnativetokenidstub_fuzzer.cpp @@ -54,7 +54,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/getnativetokeninfostub_fuzzer/getnativetokeninfostub_fuzzer.cpp b/test/fuzztest/services/accesstoken/getnativetokeninfostub_fuzzer/getnativetokeninfostub_fuzzer.cpp index 2ff9c9ad2..74064f09a 100644 --- a/test/fuzztest/services/accesstoken/getnativetokeninfostub_fuzzer/getnativetokeninfostub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/getnativetokeninfostub_fuzzer/getnativetokeninfostub_fuzzer.cpp @@ -51,7 +51,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/getpermissionflagstub_fuzzer/getpermissionflagstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/getpermissionflagstub_fuzzer/getpermissionflagstub_fuzzer.cpp index 614ce18ce..3d9e4b292 100644 --- a/test/fuzztest/services/accesstoken/getpermissionflagstub_fuzzer/getpermissionflagstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/getpermissionflagstub_fuzzer/getpermissionflagstub_fuzzer.cpp @@ -52,7 +52,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/getpermissionrequesttogglestatusstub_fuzzer/getpermissionrequesttogglestatusstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/getpermissionrequesttogglestatusstub_fuzzer/getpermissionrequesttogglestatusstub_fuzzer.cpp index 6ca346a06..64d1b8ba5 100644 --- a/test/fuzztest/services/accesstoken/getpermissionrequesttogglestatusstub_fuzzer/getpermissionrequesttogglestatusstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/getpermissionrequesttogglestatusstub_fuzzer/getpermissionrequesttogglestatusstub_fuzzer.cpp @@ -52,7 +52,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/getpermissionsstatusstub_fuzzer/getpermissionsstatusstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/getpermissionsstatusstub_fuzzer/getpermissionsstatusstub_fuzzer.cpp index 1b19b8a35..1cb3a6048 100644 --- a/test/fuzztest/services/accesstoken/getpermissionsstatusstub_fuzzer/getpermissionsstatusstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/getpermissionsstatusstub_fuzzer/getpermissionsstatusstub_fuzzer.cpp @@ -69,7 +69,7 @@ size_t g_baseFuzzPos = 0; IAccessTokenManagerIpcCode::COMMAND_GET_PERMISSIONS_STATUS); MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/getpermissionusedtypestub_fuzzer/getpermissionusedtypestub_fuzzer.cpp b/test/fuzztest/services/accesstoken/getpermissionusedtypestub_fuzzer/getpermissionusedtypestub_fuzzer.cpp index 4cc98a0b1..4646653b0 100644 --- a/test/fuzztest/services/accesstoken/getpermissionusedtypestub_fuzzer/getpermissionusedtypestub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/getpermissionusedtypestub_fuzzer/getpermissionusedtypestub_fuzzer.cpp @@ -58,7 +58,7 @@ bool GetPermissionUsedTypeStubFuzzTest(const uint8_t* data, size_t size) MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/getremotenativetokenidstub_fuzzer/getremotenativetokenidstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/getremotenativetokenidstub_fuzzer/getremotenativetokenidstub_fuzzer.cpp index cb2f9c309..f6e748eb8 100644 --- a/test/fuzztest/services/accesstoken/getremotenativetokenidstub_fuzzer/getremotenativetokenidstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/getremotenativetokenidstub_fuzzer/getremotenativetokenidstub_fuzzer.cpp @@ -59,7 +59,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { AccessTokenID accesstoken = AccessTokenKit::GetNativeTokenId("token_sync_service"); SetSelfTokenID(accesstoken); diff --git a/test/fuzztest/services/accesstoken/grantpermissionforspecifiedtimestub_fuzzer/grantpermissionforspecifiedtimestub_fuzzer.cpp b/test/fuzztest/services/accesstoken/grantpermissionforspecifiedtimestub_fuzzer/grantpermissionforspecifiedtimestub_fuzzer.cpp index d9f5580a9..74ea69bb4 100644 --- a/test/fuzztest/services/accesstoken/grantpermissionforspecifiedtimestub_fuzzer/grantpermissionforspecifiedtimestub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/grantpermissionforspecifiedtimestub_fuzzer/grantpermissionforspecifiedtimestub_fuzzer.cpp @@ -54,7 +54,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/grantpermissionstub_fuzzer/grantpermissionstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/grantpermissionstub_fuzzer/grantpermissionstub_fuzzer.cpp index 10a54d423..e1c1ae4e5 100644 --- a/test/fuzztest/services/accesstoken/grantpermissionstub_fuzzer/grantpermissionstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/grantpermissionstub_fuzzer/grantpermissionstub_fuzzer.cpp @@ -73,7 +73,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; AccessTokenID tokenIdHap; - bool enable2 = ((size % CONSTANTS_NUMBER_THREE) == 0); + bool enable2 = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_THREE) == 0); if (enable2) { AccessTokenIDEx tokenIdEx = AccessTokenKit::AllocHapToken(g_InfoParms, g_PolicyPrams); tokenIdHap = tokenIdEx.tokenIDEx; @@ -85,7 +85,7 @@ namespace OHOS { std::map tokenIdAplMap; AccessTokenInfoManager::GetInstance().Init(hapSize, nativeSize, pefDefSize, dlpSize, tokenIdAplMap); } - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/inithaptokenstub_fuzzer/inithaptokenstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/inithaptokenstub_fuzzer/inithaptokenstub_fuzzer.cpp index fd2cec315..465f60c7d 100644 --- a/test/fuzztest/services/accesstoken/inithaptokenstub_fuzzer/inithaptokenstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/inithaptokenstub_fuzzer/inithaptokenstub_fuzzer.cpp @@ -122,7 +122,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/inituserpolicystub_fuzzer/inituserpolicystub_fuzzer.cpp b/test/fuzztest/services/accesstoken/inituserpolicystub_fuzzer/inituserpolicystub_fuzzer.cpp index 51d818763..1621cdbee 100644 --- a/test/fuzztest/services/accesstoken/inituserpolicystub_fuzzer/inituserpolicystub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/inituserpolicystub_fuzzer/inituserpolicystub_fuzzer.cpp @@ -138,7 +138,7 @@ bool InitUserPolicyStubFuzzTest(const uint8_t* data, size_t size) MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { GetNativeToken(); } else { diff --git a/test/fuzztest/services/accesstoken/registerselfpermstatechangecallbackstub_fuzzer/registerselfpermstatechangecallbackstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/registerselfpermstatechangecallbackstub_fuzzer/registerselfpermstatechangecallbackstub_fuzzer.cpp index 6de50c661..c059674e1 100644 --- a/test/fuzztest/services/accesstoken/registerselfpermstatechangecallbackstub_fuzzer/registerselfpermstatechangecallbackstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/registerselfpermstatechangecallbackstub_fuzzer/registerselfpermstatechangecallbackstub_fuzzer.cpp @@ -115,7 +115,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { GetHapToken(); } else { diff --git a/test/fuzztest/services/accesstoken/revokepermissionstub_fuzzer/revokepermissionstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/revokepermissionstub_fuzzer/revokepermissionstub_fuzzer.cpp index c344df439..ecb1d4488 100644 --- a/test/fuzztest/services/accesstoken/revokepermissionstub_fuzzer/revokepermissionstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/revokepermissionstub_fuzzer/revokepermissionstub_fuzzer.cpp @@ -55,7 +55,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/setpermissionrequesttogglestatusstub_fuzzer/setpermissionrequesttogglestatusstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/setpermissionrequesttogglestatusstub_fuzzer/setpermissionrequesttogglestatusstub_fuzzer.cpp index 5125344a3..c31b8910f 100644 --- a/test/fuzztest/services/accesstoken/setpermissionrequesttogglestatusstub_fuzzer/setpermissionrequesttogglestatusstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/setpermissionrequesttogglestatusstub_fuzzer/setpermissionrequesttogglestatusstub_fuzzer.cpp @@ -54,7 +54,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/setremotehaptokeninfostub_fuzzer/setremotehaptokeninfostub_fuzzer.cpp b/test/fuzztest/services/accesstoken/setremotehaptokeninfostub_fuzzer/setremotehaptokeninfostub_fuzzer.cpp index 56b7a11e6..f63358f14 100644 --- a/test/fuzztest/services/accesstoken/setremotehaptokeninfostub_fuzzer/setremotehaptokeninfostub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/setremotehaptokeninfostub_fuzzer/setremotehaptokeninfostub_fuzzer.cpp @@ -90,7 +90,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { AccessTokenID accesstoken = AccessTokenKit::GetNativeTokenId("token_sync_service"); SetSelfTokenID(accesstoken); diff --git a/test/fuzztest/services/accesstoken/updatehaptokenstub_fuzzer/updatehaptokenstub_fuzzer.cpp b/test/fuzztest/services/accesstoken/updatehaptokenstub_fuzzer/updatehaptokenstub_fuzzer.cpp index f4f7dec73..894e9c05e 100644 --- a/test/fuzztest/services/accesstoken/updatehaptokenstub_fuzzer/updatehaptokenstub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/updatehaptokenstub_fuzzer/updatehaptokenstub_fuzzer.cpp @@ -108,7 +108,7 @@ namespace OHOS { uint32_t code = static_cast(IAccessTokenManagerIpcCode::COMMAND_UPDATE_HAP_TOKEN); MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/accesstoken/updateuserpolicystub_fuzzer/updateuserpolicystub_fuzzer.cpp b/test/fuzztest/services/accesstoken/updateuserpolicystub_fuzzer/updateuserpolicystub_fuzzer.cpp index 0dbec3788..50d61bd82 100644 --- a/test/fuzztest/services/accesstoken/updateuserpolicystub_fuzzer/updateuserpolicystub_fuzzer.cpp +++ b/test/fuzztest/services/accesstoken/updateuserpolicystub_fuzzer/updateuserpolicystub_fuzzer.cpp @@ -91,7 +91,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { GetNativeToken(); } else { diff --git a/test/fuzztest/services/privacy/getpermissionusedrecordtogglestatusstub_fuzzer/getpermissionusedrecordtogglestatusstub_fuzzer.cpp b/test/fuzztest/services/privacy/getpermissionusedrecordtogglestatusstub_fuzzer/getpermissionusedrecordtogglestatusstub_fuzzer.cpp index c60b4dce6..ffd3d4798 100644 --- a/test/fuzztest/services/privacy/getpermissionusedrecordtogglestatusstub_fuzzer/getpermissionusedrecordtogglestatusstub_fuzzer.cpp +++ b/test/fuzztest/services/privacy/getpermissionusedrecordtogglestatusstub_fuzzer/getpermissionusedrecordtogglestatusstub_fuzzer.cpp @@ -46,7 +46,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/privacy/sethapwithfgreminderstub_fuzzer/sethapwithfgreminderstub_fuzzer.cpp b/test/fuzztest/services/privacy/sethapwithfgreminderstub_fuzzer/sethapwithfgreminderstub_fuzzer.cpp index 87af0e03a..e984d9192 100644 --- a/test/fuzztest/services/privacy/sethapwithfgreminderstub_fuzzer/sethapwithfgreminderstub_fuzzer.cpp +++ b/test/fuzztest/services/privacy/sethapwithfgreminderstub_fuzzer/sethapwithfgreminderstub_fuzzer.cpp @@ -87,7 +87,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/privacy/setmutepolicystub_fuzzer/setmutepolicystub_fuzzer.cpp b/test/fuzztest/services/privacy/setmutepolicystub_fuzzer/setmutepolicystub_fuzzer.cpp index 5b7274e6f..b49e02e09 100644 --- a/test/fuzztest/services/privacy/setmutepolicystub_fuzzer/setmutepolicystub_fuzzer.cpp +++ b/test/fuzztest/services/privacy/setmutepolicystub_fuzzer/setmutepolicystub_fuzzer.cpp @@ -98,7 +98,7 @@ size_t g_baseFuzzPos = 0; MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } diff --git a/test/fuzztest/services/privacy/setpermissionusedrecordtogglestatusstub_fuzzer/setpermissionusedrecordtogglestatusstub_fuzzer.cpp b/test/fuzztest/services/privacy/setpermissionusedrecordtogglestatusstub_fuzzer/setpermissionusedrecordtogglestatusstub_fuzzer.cpp index d9c7f9c90..8c8cec7bb 100644 --- a/test/fuzztest/services/privacy/setpermissionusedrecordtogglestatusstub_fuzzer/setpermissionusedrecordtogglestatusstub_fuzzer.cpp +++ b/test/fuzztest/services/privacy/setpermissionusedrecordtogglestatusstub_fuzzer/setpermissionusedrecordtogglestatusstub_fuzzer.cpp @@ -47,7 +47,7 @@ namespace OHOS { MessageParcel reply; MessageOption option; - bool enable = ((size % CONSTANTS_NUMBER_TWO) == 0); + bool enable = ((provider.ConsumeIntegral() % CONSTANTS_NUMBER_TWO) == 0); if (enable) { setuid(CONSTANTS_NUMBER_TWO); } -- Gitee