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 d0569f0fd3c0ec0abb76b60e65d744e67e4cc159..4ef1b4c05949e903fde1f9f7b889987c179c5e6a 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 d6f7ff8f43d101cdfa7815ae799f599f08bbeef2..a0f47030165448892b635d061b4ead757ae6d877 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 6e039068ba626893d1a05704b1ff73796dfa9977..594a66c56747a7706eedebdfb2248042413ddd7e 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 c1083eab995176f1c81e7469c73e5f2f2a0e7417..dc9307835bdfa16aae3cfa13b23736fba2ade699 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 049f197f884f6d5b473142c9b4291058df18ec24..264b48511c2c8a91174cdc532ceec22d04bce429 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 235ac7e3a6769b93425b19323caff07f26b8ca3c..1da6e03059c78c3fc6362bc0ad41dade8fd9e928 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 f0176436ba9316bab3f35d6e0af53db9fa5e03e1..b96edd3fb5d39f0acd7fa441284c2fba6b431643 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 2b2267bb4bed4751cb7551c9734d20b05ef4a4dd..23c502e95ec7fc241e2a4951863f10756a8f5683 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 30e899678ab4bc80d2de3ed24c9caaef67cc1dca..eefc29c51864da0fc2de86479d38ba2b5015e52f 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 7fa2f67424fcfeb932e480702c29fc9bf0c2c3f9..10ea736632a751ca6931b9490ec9c2dbbd7dbb37 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 8039d723265ee111d66f7ba5ed78faad23da4e04..98c769efe3525df5eaf728aa241f0c0e4a276de9 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 32492574a1a7d4753e2acd110ebede4bd265e3d1..1fa95d9a63de5da77ccdc4854fd31e19aa570ab7 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 35de2db2274eb70cf9f988fc3045f4f9b4c4782d..061b7cb1018696dd353c48f6484e9a3c50a34d2e 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 e9af186c92a042f52a888573c27d1038105dc1b7..37ab57ac361dded7fc34d7c7fde92b513d82d50f 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 faea9dcf88ace7734fcdbd24ae87c77cd4e4755f..0598193fe7f8cd799d8e5942eae1c6fb06ad63dd 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 137dcbcf906e2ac1aa4d76f1fe4676a45060641f..6de4ea48d3f6462aa7f79cc80c43fddafb23f111 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 1f6b07eb3201176dc2e58833f051ddcd3f678ad1..af1ae0d9481fff1d5b07619fb3cf0da8b88b73ef 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 33a05491030a117b6f6789a17de838ee609e959f..75908ff5850d187f152f2e07cecabf40256e8c82 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 3bb6219a2466ce9cf2d9d225e68218dd978f0aea..9d1480999e09b1b5a7a169d200f5ac2cabfd0bd7 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 1f624fe38759d8c3ea47b4de05c264c0e151bed6..81c323269fa2bf077bdf4adeed3fbd25d8a4dfe4 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 2ff9c9ad2791996869cceffc78e0fbf88890cbf7..74064f09af2da323fa4b2adef717e21a0832c46f 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 614ce18ce16ab043d9778da0ff17ec8ca8590ef2..3d9e4b2927fc7fc5726365004f96094d7f4e15b6 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 6ca346a06f3e1d072e36acc56c6db978a0e2392c..64d1b8ba519f0f0735d8d698e4e3284f6a9e6b9e 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 1b19b8a35e57a6a444d0ee74f213591d153c7fd5..1cb3a60480f69f48dab0f7a9b9e684208976e73c 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 4cc98a0b195952b7f4d606a9565390c586ad2f02..4646653b0adf40e7b07223bf7252a4e89c47fe7a 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 cb2f9c309987e6b3d71ab2622b4abb3450be30e0..f6e748eb847ab0f10f4e8df9843b6d41b7378a4a 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 d9f5580a956e3983abff1012e8dff7778c3cb514..74ea69bb4cc9a23e7d73a94ebfaf6bb6f3b945f1 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 10a54d423680595077d1af22a8eb94672f2a2f71..e1c1ae4e5327ce60d4d370e3f55ef560d743b2c8 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 fd2cec3157a0006eeefcb550f733b87804f46937..465f60c7d210717c0c985b376968b0f289fba287 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 51d8187631f2502fa7caf56131cb71beb8ccb21b..1621cdbeee42f5f4a2687cbb111e7c2cfd492b09 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 6de50c66129c40d6d9fc206736576ae6ef34c06c..c059674e114a29ab55de356d2a020d5f1f1786b9 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 c344df43976955614969190a97a21cb790e462d5..ecb1d4488ab55d8e2e14c8cd5d5e71cb80e8b123 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 5125344a3e73356d7eff2f016a6fb72578056452..c31b8910fd72b8b54a1a1b61415fc147ffb4efbd 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 56b7a11e69b27c268d9b8648a5c944d3e5ecdf29..f63358f147eade5527e4b71e9b2ccc5a3235500b 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 f4f7dec731ac09f78dd9e0cd19059b4d18deb769..894e9c05edb165e0b39c4f345f0509dc0d55cae9 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 0dbec3788f943c807f8a06f6760962832deaff03..50d61bd825d70f69cc98434010743afce4f5efde 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 c60b4dce67c377402d148c14e81c436ffc51f942..ffd3d4798d371a5073ff4f2fff7100d7ffea7f79 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 87af0e03a58969d85076cbb8e104638e92493068..e984d91926e049c85b7e7dec2f2cec37eb5ca8e4 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 5b7274e6f3896285bbf863a078bec3679d38ff0d..b49e02e09241cc34d47d36a0a8cb1ee453eb45b5 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 d9c7f9c902ab003b306cbe7536cbf8477fa6ee25..8c8cec7bbb5cbdc1b158c6e35654b88fc52902d4 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); }