diff --git a/test/fuzztest/fuzztest_application/bundleinfo_fuzzer/bundleinfo_fuzzer.cpp b/test/fuzztest/fuzztest_application/bundleinfo_fuzzer/bundleinfo_fuzzer.cpp index 89934f87c7e1e590f3f7519b82f912c7ad1325f5..ff31a3325bd6bf88de9c708fb6afffc46f855a34 100644 --- a/test/fuzztest/fuzztest_application/bundleinfo_fuzzer/bundleinfo_fuzzer.cpp +++ b/test/fuzztest/fuzztest_application/bundleinfo_fuzzer/bundleinfo_fuzzer.cpp @@ -25,6 +25,7 @@ namespace OHOS { { Parcel dataMessageParcel; BundleInfo oldBundleInfo; + oldBundleInfo.name = std::string(reinterpret_cast(data), size); if (!oldBundleInfo.Marshalling(dataMessageParcel)) { return false; } diff --git a/test/fuzztest/fuzztest_information/abilityinfounmarshalling_fuzzer/abilityinfounmarshalling_fuzzer.cpp b/test/fuzztest/fuzztest_information/abilityinfounmarshalling_fuzzer/abilityinfounmarshalling_fuzzer.cpp index a63f8d3bd5e4baea7d7d75f11d0d4c797706df6a..0601f12c17613ce7cae5caf8fc90d3647d6defb5 100644 --- a/test/fuzztest/fuzztest_information/abilityinfounmarshalling_fuzzer/abilityinfounmarshalling_fuzzer.cpp +++ b/test/fuzztest/fuzztest_information/abilityinfounmarshalling_fuzzer/abilityinfounmarshalling_fuzzer.cpp @@ -27,6 +27,7 @@ namespace OHOS { { Parcel dataMessageParcel; AbilityInfo oldAbilityInfo; + oldAbilityInfo.name = std::string(reinterpret_cast(data), size); if (!oldAbilityInfo.Marshalling(dataMessageParcel)) { return false; } diff --git a/test/fuzztest/fuzztest_others/GetExtResource_fuzzer/GetExtResource_fuzzer.cpp b/test/fuzztest/fuzztest_others/GetExtResource_fuzzer/GetExtResource_fuzzer.cpp index 08cfd841bca8dd58e19a0353fb2f2d6ded6482f5..98fefda45ff473c9411f3b0b7c8b59b90c236a6c 100644 --- a/test/fuzztest/fuzztest_others/GetExtResource_fuzzer/GetExtResource_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/GetExtResource_fuzzer/GetExtResource_fuzzer.cpp @@ -25,7 +25,7 @@ namespace OHOS { bool fuzzelGetExtResourceCaseOne(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; - std::string emptyBundleName; + std::string emptyBundleName = std::string(reinterpret_cast(data), size); std::vector moduleNames; auto ret = impl.GetExtResource(emptyBundleName, moduleNames); if (ret == ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST) { @@ -37,7 +37,7 @@ namespace OHOS { bool fuzzerlGetExtResourceCaseTwo(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; - std::vector moduleNames; + std::vector moduleNames = {std::string(reinterpret_cast(data), size)}; auto ret = impl.GetExtResource(FUZZTEST_BUNDLE, moduleNames); if (ret == ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST) { return true; diff --git a/test/fuzztest/fuzztest_others/RemoveExtResource_fuzzer/RemoveExtResource_fuzzer.cpp b/test/fuzztest/fuzztest_others/RemoveExtResource_fuzzer/RemoveExtResource_fuzzer.cpp index f65ce390b0af07abec2134ec976a594e260fd2a3..48c9516952a5b4a775d42ff2b699e1f0cd0fffab 100644 --- a/test/fuzztest/fuzztest_others/RemoveExtResource_fuzzer/RemoveExtResource_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/RemoveExtResource_fuzzer/RemoveExtResource_fuzzer.cpp @@ -26,7 +26,7 @@ namespace OHOS { { ExtendResourceManagerHostImpl impl; std::string emptyBundleName; - std::vector moduleNames; + std::vector moduleNames = {std::string(reinterpret_cast(data), size)}; auto ret = impl.RemoveExtResource(emptyBundleName, moduleNames); if (ret == ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST) { return true; @@ -37,7 +37,7 @@ namespace OHOS { bool fuzzelRemoveExtResourceCaseTwo(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; - std::vector moduleNames; + std::vector moduleNames = {std::string(reinterpret_cast(data), size)}; auto ret = impl.RemoveExtResource(FUZZTEST_BUNDLE, moduleNames); if (ret == ERR_EXT_RESOURCE_MANAGER_REMOVE_EXT_RESOURCE_FAILED) { return true; @@ -48,7 +48,7 @@ namespace OHOS { bool fuzzelRemoveExtResourceCaseThree(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; - std::vector moduleNames; + std::vector moduleNames = {std::string(reinterpret_cast(data), size)}; moduleNames.push_back(FUZZTEST_MODULE); auto ret = impl.RemoveExtResource(FUZZTEST_BUNDLE, moduleNames); if (ret == ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST) { diff --git a/test/fuzztest/fuzztest_others/accounthelper_fuzzer/accounthelper_fuzzer.cpp b/test/fuzztest/fuzztest_others/accounthelper_fuzzer/accounthelper_fuzzer.cpp index 6cbc697d946e681d8481358e4558a402d06f8e74..3412d91226e7f0f94e1e9e0f47fb53d6e2afaaa7 100644 --- a/test/fuzztest/fuzztest_others/accounthelper_fuzzer/accounthelper_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/accounthelper_fuzzer/accounthelper_fuzzer.cpp @@ -26,7 +26,7 @@ constexpr size_t U32_AT_SIZE = 4; bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { int32_t id = 100; - bool isOsAccountExists = true; + bool isOsAccountExists = reinterpret_cast(data) % 2; AccountHelper::IsOsAccountExists(id, isOsAccountExists); AccountHelper::GetCurrentActiveUserId(); AccountHelper::IsOsAccountVerified(id); diff --git a/test/fuzztest/fuzztest_others/aginghandlerchain_fuzzer/aginghandlerchain_fuzzer.cpp b/test/fuzztest/fuzztest_others/aginghandlerchain_fuzzer/aginghandlerchain_fuzzer.cpp index 1fcbdd5815e3f430a2929cc494ab68efdf47c811..a690497c59160678afd3c1b899f8d890e8bdf54b 100644 --- a/test/fuzztest/fuzztest_others/aginghandlerchain_fuzzer/aginghandlerchain_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/aginghandlerchain_fuzzer/aginghandlerchain_fuzzer.cpp @@ -26,6 +26,7 @@ constexpr uint8_t ENABLE = 2; bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { AgingRequest request; + request.SetTotalDataBytes(reinterpret_cast(data)); AgingHandlerChain agingHandlerChain; std::shared_ptr handler; agingHandlerChain.AddHandler(handler); diff --git a/test/fuzztest/fuzztest_others/agingutil_fuzzer/agingutil_fuzzer.cpp b/test/fuzztest/fuzztest_others/agingutil_fuzzer/agingutil_fuzzer.cpp index 68fc0d16d4f9e05bcd3338e02157a8c9f9314898..c6f981dd33bced6c564771115ff6e0f1c15da166 100644 --- a/test/fuzztest/fuzztest_others/agingutil_fuzzer/agingutil_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/agingutil_fuzzer/agingutil_fuzzer.cpp @@ -27,7 +27,10 @@ constexpr size_t U32_AT_SIZE = 4; constexpr uint8_t ENABLE = 2; bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { - AgingBundleInfo agingBundleInfo; + std::string name = std::string(data, size); + int64_t time = reinterpret_cast(data); + int32_t startCount = 0; + AgingBundleInfo agingBundleInfo{name, time, startCount}; agingBundleInfo.GetBundleName(); agingBundleInfo.GetRecentlyUsedTime(); agingBundleInfo.GetStartCount(); diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstalleraddappprovisioninfo_fuzzer/appservicefwkinstalleraddappprovisioninfo_fuzzer.cpp b/test/fuzztest/fuzztest_others/appservicefwkinstalleraddappprovisioninfo_fuzzer/appservicefwkinstalleraddappprovisioninfo_fuzzer.cpp index 2ce573bbd38f085fa3091ca45c74f79119e6e4c1..788c48ca00546f1df1ab9bc57a1507b1d037652c 100644 --- a/test/fuzztest/fuzztest_others/appservicefwkinstalleraddappprovisioninfo_fuzzer/appservicefwkinstalleraddappprovisioninfo_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/appservicefwkinstalleraddappprovisioninfo_fuzzer/appservicefwkinstalleraddappprovisioninfo_fuzzer.cpp @@ -30,7 +30,8 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { InstallParam installParam; - installParam.isPreInstallApp = false; + bool isPreInstallApp = reinterpret_cast(data) % 2; + installParam.isPreInstallApp = isPreInstallApp; installParam.specifiedDistributionType = BUNDLE_NAME; installParam.additionalInfo = BUNDLE_NAME; AppServiceFwkInstaller appServiceFwk; diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstallerbeforeinstall_fuzzer/appservicefwkinstallerbeforeinstall_fuzzer.cpp b/test/fuzztest/fuzztest_others/appservicefwkinstallerbeforeinstall_fuzzer/appservicefwkinstallerbeforeinstall_fuzzer.cpp index 7f84c7aa834d068691df2629d7ea1cfc09d083bd..cfdc536998f95ed8716df3cf2fa101a20890eb5b 100644 --- a/test/fuzztest/fuzztest_others/appservicefwkinstallerbeforeinstall_fuzzer/appservicefwkinstallerbeforeinstall_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/appservicefwkinstallerbeforeinstall_fuzzer/appservicefwkinstallerbeforeinstall_fuzzer.cpp @@ -32,7 +32,7 @@ namespace OHOS { installParam.isPreInstallApp = true; installParam.removable = false; AppServiceFwkInstaller appServicefwk; - std::vector hspPaths = { std::string(data, size) }; + std::vector hspPaths = {std::string(data, size)}; appServicefwk.BeforeInstall(hspPaths, installParam); return true; } diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstallergetinnerbundleinfo_fuzzer/appservicefwkinstallergetinnerbundleinfo_fuzzer.cpp b/test/fuzztest/fuzztest_others/appservicefwkinstallergetinnerbundleinfo_fuzzer/appservicefwkinstallergetinnerbundleinfo_fuzzer.cpp index e6fc90a721ff346ac53bf28d2a6854581243e38d..28514a3a570f4beec821d42a2a67c64e1484fefc 100644 --- a/test/fuzztest/fuzztest_others/appservicefwkinstallergetinnerbundleinfo_fuzzer/appservicefwkinstallergetinnerbundleinfo_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/appservicefwkinstallergetinnerbundleinfo_fuzzer/appservicefwkinstallergetinnerbundleinfo_fuzzer.cpp @@ -30,7 +30,7 @@ namespace OHOS { { AppServiceFwkInstaller appServiceFwk; InnerBundleInfo info; - bool isAppExist; + bool isAppExist = reinterpret_cast(data) % 2; appServiceFwk.GetInnerBundleInfoWithDisable(info, isAppExist); return true; } diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstallerinnerprocessinstall_fuzzer/appservicefwkinstallerinnerprocessinstall_fuzzer.cpp b/test/fuzztest/fuzztest_others/appservicefwkinstallerinnerprocessinstall_fuzzer/appservicefwkinstallerinnerprocessinstall_fuzzer.cpp index 97f5ff74db7b2a6fa2717804b46a468730c3577c..688b9e88f1470fc9fa6a784296893d35df010c57 100644 --- a/test/fuzztest/fuzztest_others/appservicefwkinstallerinnerprocessinstall_fuzzer/appservicefwkinstallerinnerprocessinstall_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/appservicefwkinstallerinnerprocessinstall_fuzzer/appservicefwkinstallerinnerprocessinstall_fuzzer.cpp @@ -29,7 +29,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { InstallParam installParam; - installParam.isPreInstallApp = true; + installParam.isPreInstallApp = reinterpret_cast(data) % 2; installParam.removable = false; AppServiceFwkInstaller appServicefwk; std::unordered_map newInfos; diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstallermergebundleinfos_fuzzer/appservicefwkinstallermergebundleinfos_fuzzer.cpp b/test/fuzztest/fuzztest_others/appservicefwkinstallermergebundleinfos_fuzzer/appservicefwkinstallermergebundleinfos_fuzzer.cpp index cbf57a4d044249f2c201a5de82780402c955c7b0..3f4fd501a96d53799b095b52242beb18eff43e4b 100644 --- a/test/fuzztest/fuzztest_others/appservicefwkinstallermergebundleinfos_fuzzer/appservicefwkinstallermergebundleinfos_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/appservicefwkinstallermergebundleinfos_fuzzer/appservicefwkinstallermergebundleinfos_fuzzer.cpp @@ -31,6 +31,8 @@ namespace OHOS { { AppServiceFwkInstaller appServicefwk; InnerBundleInfo innerBundleInfo; + int64_t installTime = reinterpret_cast(data); + innerBundleInfo.SetBundleInstallTime(installTime); innerBundleInfo.currentPackage_ = MODULE_NAME_TEST; appServicefwk.MergeBundleInfos(innerBundleInfo); return true; diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstallermovesotorealpath_fuzzer/appservicefwkinstallermovesotorealpath_fuzzer.cpp b/test/fuzztest/fuzztest_others/appservicefwkinstallermovesotorealpath_fuzzer/appservicefwkinstallermovesotorealpath_fuzzer.cpp index b95b0b758e7c391de57f308115435d0cbe9b646c..afcc0d1a3f066c784112340012a16555ebb27ef1 100644 --- a/test/fuzztest/fuzztest_others/appservicefwkinstallermovesotorealpath_fuzzer/appservicefwkinstallermovesotorealpath_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/appservicefwkinstallermovesotorealpath_fuzzer/appservicefwkinstallermovesotorealpath_fuzzer.cpp @@ -29,7 +29,8 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { AppServiceFwkInstaller appServicefwk; - appServicefwk.MoveSoToRealPath("", "", ""); + std::string moduleName = std::string(data, size); + appServicefwk.MoveSoToRealPath(moduleName, "", ""); return true; } } diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstallerprocessnativelibrary_fuzzer/appservicefwkinstallerprocessnativelibrary_fuzzer.cpp b/test/fuzztest/fuzztest_others/appservicefwkinstallerprocessnativelibrary_fuzzer/appservicefwkinstallerprocessnativelibrary_fuzzer.cpp index aaf679f56e3540fb1053b080173d4701b5aa2a07..0353d82c15e41a01ed68efc9706000c93246ef51 100644 --- a/test/fuzztest/fuzztest_others/appservicefwkinstallerprocessnativelibrary_fuzzer/appservicefwkinstallerprocessnativelibrary_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/appservicefwkinstallerprocessnativelibrary_fuzzer/appservicefwkinstallerprocessnativelibrary_fuzzer.cpp @@ -27,15 +27,15 @@ namespace OHOS { constexpr size_t U32_AT_SIZE = 4; const std::string VERSION_ONE_LIBRARY_ONE_PATH = "/data/test/resource/bms/app_service_test/appService_v1_library1.hsp"; const std::string BUNDLE_DATA_DIR = "/data/app/el2/100/base/com.example.l3jsdemo"; -const std::string MODULE_NAME_TEST = "moduleName"; bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { AppServiceFwkInstaller appServicefwk; InnerBundleInfo innerBundleInfo; - innerBundleInfo.currentPackage_ = MODULE_NAME_TEST; + std::string moduleName = std::string(data, size); + innerBundleInfo.currentPackage_ = moduleName; appServicefwk.ProcessNativeLibrary( - VERSION_ONE_LIBRARY_ONE_PATH, BUNDLE_DATA_DIR, MODULE_NAME_TEST, BUNDLE_DATA_DIR, innerBundleInfo); + VERSION_ONE_LIBRARY_ONE_PATH, BUNDLE_DATA_DIR, moduleName, BUNDLE_DATA_DIR, innerBundleInfo); return true; } } // namespace OHOS diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstallerremovebundlecodedir_fuzzer/appservicefwkinstallerremovebundlecodedir_fuzzer.cpp b/test/fuzztest/fuzztest_others/appservicefwkinstallerremovebundlecodedir_fuzzer/appservicefwkinstallerremovebundlecodedir_fuzzer.cpp index daab087c0a3daf68bd9afd71e19ec60d5c7b9e4f..c816954535c0cf0b761b4c4dfd49dc5f4328ac7e 100644 --- a/test/fuzztest/fuzztest_others/appservicefwkinstallerremovebundlecodedir_fuzzer/appservicefwkinstallerremovebundlecodedir_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/appservicefwkinstallerremovebundlecodedir_fuzzer/appservicefwkinstallerremovebundlecodedir_fuzzer.cpp @@ -30,6 +30,7 @@ namespace OHOS { { AppServiceFwkInstaller appServiceFwk; InnerBundleInfo info; + info.SetAppCodePath(std::string(data, size)); appServiceFwk.RemoveBundleCodeDir(info); return true; } diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstallerremoveinfo_fuzzer/appservicefwkinstallerremoveinfo_fuzzer.cpp b/test/fuzztest/fuzztest_others/appservicefwkinstallerremoveinfo_fuzzer/appservicefwkinstallerremoveinfo_fuzzer.cpp index d27d9a5012f013fdf99b7d6bccb5d43d0434bd8c..d2a6548f7c07b28b8ffa912de0421215ea2b35b9 100644 --- a/test/fuzztest/fuzztest_others/appservicefwkinstallerremoveinfo_fuzzer/appservicefwkinstallerremoveinfo_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/appservicefwkinstallerremoveinfo_fuzzer/appservicefwkinstallerremoveinfo_fuzzer.cpp @@ -29,7 +29,8 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { AppServiceFwkInstaller appServiceFwk; - appServiceFwk.RemoveInfo(""); + std::string bundleName = std::string(data, size); + appServiceFwk.RemoveInfo(bundleName); return true; } } diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstallerrollback_fuzzer/appservicefwkinstallerrollback_fuzzer.cpp b/test/fuzztest/fuzztest_others/appservicefwkinstallerrollback_fuzzer/appservicefwkinstallerrollback_fuzzer.cpp index d3d202cac1b788c6ae9130dc4931778ec9e9924a..77375a160c563cb043c88645db1ea36b0618cae0 100644 --- a/test/fuzztest/fuzztest_others/appservicefwkinstallerrollback_fuzzer/appservicefwkinstallerrollback_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/appservicefwkinstallerrollback_fuzzer/appservicefwkinstallerrollback_fuzzer.cpp @@ -29,6 +29,8 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { AppServiceFwkInstaller appServicefwk; + std::string bundleName = std::string(data, size); + appServicefwk.bundleName_ = bundleName; appServicefwk.RollBack(); return true; } diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstallersavebundleinfotostorage_fuzzer/appservicefwkinstallersavebundleinfotostorage_fuzzer.cpp b/test/fuzztest/fuzztest_others/appservicefwkinstallersavebundleinfotostorage_fuzzer/appservicefwkinstallersavebundleinfotostorage_fuzzer.cpp index 85ccf53deaa3f21b0fc97ecca73e0e0b877e9bca..9105743d79a1450f418b123e001204e07316de4c 100644 --- a/test/fuzztest/fuzztest_others/appservicefwkinstallersavebundleinfotostorage_fuzzer/appservicefwkinstallersavebundleinfotostorage_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/appservicefwkinstallersavebundleinfotostorage_fuzzer/appservicefwkinstallersavebundleinfotostorage_fuzzer.cpp @@ -29,6 +29,8 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { AppServiceFwkInstaller appServicefwk; + std::string bundleName = std::string(data, size); + appServicefwk.bundleName_ = bundleName; appServicefwk.SaveBundleInfoToStorage(); return true; } diff --git a/test/fuzztest/fuzztest_others/appservicefwkinstallersavepreinstallbundleinfo_fuzzer/appservicefwkinstallersavepreinstallbundleinfo_fuzzer.cpp b/test/fuzztest/fuzztest_others/appservicefwkinstallersavepreinstallbundleinfo_fuzzer/appservicefwkinstallersavepreinstallbundleinfo_fuzzer.cpp index 0b8606656db8425c354ab4c0cca5c3776bd0f9cf..832812814333966cf6b128b210503a7eb77e61bb 100644 --- a/test/fuzztest/fuzztest_others/appservicefwkinstallersavepreinstallbundleinfo_fuzzer/appservicefwkinstallersavepreinstallbundleinfo_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/appservicefwkinstallersavepreinstallbundleinfo_fuzzer/appservicefwkinstallersavepreinstallbundleinfo_fuzzer.cpp @@ -31,7 +31,8 @@ namespace OHOS { AppServiceFwkInstaller appServiceFwk; std::unordered_map infos; InstallParam installParam; - installParam.needSavePreInstallInfo = true; + bool needSavePreInstallInfo = reinterpret_cast(data) % 2; + installParam.needSavePreInstallInfo = needSavePreInstallInfo; appServiceFwk.SavePreInstallBundleInfo(ERR_APPEXECFWK_INSTALL_PARAM_ERROR, infos, installParam); return true; } diff --git a/test/fuzztest/fuzztest_others/basebundleinstallercheckmultiplehapssigninfo_fuzzer/basebundleinstallercheckmultiplehapssigninfo_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallercheckmultiplehapssigninfo_fuzzer/basebundleinstallercheckmultiplehapssigninfo_fuzzer.cpp index a49719801536f010913c2aa99d5bc52786dcac5b..7c0b467c5e8bb0d69624bf914f790043fa64a60d 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallercheckmultiplehapssigninfo_fuzzer/basebundleinstallercheckmultiplehapssigninfo_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallercheckmultiplehapssigninfo_fuzzer/basebundleinstallercheckmultiplehapssigninfo_fuzzer.cpp @@ -29,6 +29,7 @@ namespace OHOS { BaseBundleInstaller basebundleinstall; std::vector bundlePaths; InstallParam installParam; + installParam.additionalInfo = std::string(data, size); std::vector hapVerifyRes; auto ret1 = basebundleinstall.CheckMultipleHapsSignInfo(bundlePaths, installParam, hapVerifyRes); return true; diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerchecksyscap_fuzzer/basebundleinstallerchecksyscap_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerchecksyscap_fuzzer/basebundleinstallerchecksyscap_fuzzer.cpp index 59c128f00ac1acd96a1a5deebd8364bc575fc9d2..16c8af7a066e49a1e2c609c62c17f494c7340f06 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerchecksyscap_fuzzer/basebundleinstallerchecksyscap_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerchecksyscap_fuzzer/basebundleinstallerchecksyscap_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) { BaseBundleInstaller basebundleinstall; - std::vector bundlePaths; + std::vector bundlePaths = {std::string(data, size)}; auto ret1 = basebundleinstall.CheckSysCap(bundlePaths); return true; } diff --git a/test/fuzztest/fuzztest_others/basebundleinstallercheckuninstallinnerbundleinfo_fuzzer/basebundleinstallercheckuninstallinnerbundleinfo_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallercheckuninstallinnerbundleinfo_fuzzer/basebundleinstallercheckuninstallinnerbundleinfo_fuzzer.cpp index 419c6481839b03083ef1fd20b300f4056a1a0d8d..cc83d8e1c1651b4860a32ade97d9ede9094a0cbc 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallercheckuninstallinnerbundleinfo_fuzzer/basebundleinstallercheckuninstallinnerbundleinfo_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallercheckuninstallinnerbundleinfo_fuzzer/basebundleinstallercheckuninstallinnerbundleinfo_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { { BaseBundleInstaller basebundleinstall; InnerBundleInfo info; - std::string bundleName; + std::string bundleName = std::string(data, size); auto ret1 = basebundleinstall.CheckUninstallInnerBundleInfo(info, bundleName); return true; } diff --git a/test/fuzztest/fuzztest_others/basebundleinstallercreatebundleanddatadir_fuzzer/basebundleinstallercreatebundleanddatadir_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallercreatebundleanddatadir_fuzzer/basebundleinstallercreatebundleanddatadir_fuzzer.cpp index 9bfba6254b25666b9d01585116a0b5a25ce66e84..3b030b6f81cdfe6d1da1f736ff6617009dbd8994 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallercreatebundleanddatadir_fuzzer/basebundleinstallercreatebundleanddatadir_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallercreatebundleanddatadir_fuzzer/basebundleinstallercreatebundleanddatadir_fuzzer.cpp @@ -28,6 +28,7 @@ namespace OHOS { { BaseBundleInstaller basebundleinstall; InnerBundleInfo info; + info.SetBundleInstallTime(reinterpret_cast(data)); auto ret1 = basebundleinstall.CreateBundleAndDataDir(info); return true; } diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerextractmodule_fuzzer/basebundleinstallerextractmodule_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerextractmodule_fuzzer/basebundleinstallerextractmodule_fuzzer.cpp index 448d3bd29d8a7b827e26f51c2e9740b8cf14fcb4..18a43441032d0b32056d5d7eb6917e5f21222684 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerextractmodule_fuzzer/basebundleinstallerextractmodule_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerextractmodule_fuzzer/basebundleinstallerextractmodule_fuzzer.cpp @@ -28,6 +28,7 @@ namespace OHOS { { BaseBundleInstaller basebundleinstall; InnerBundleInfo info; + info.SetBundleInstallTime(reinterpret_cast(data)); std::string modulePath; auto ret1 = basebundleinstall.ExtractModule(info, modulePath); return true; diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerextractmodulefiles_fuzzer/basebundleinstallerextractmodulefiles_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerextractmodulefiles_fuzzer/basebundleinstallerextractmodulefiles_fuzzer.cpp index 1edcdbeba4f6464d20f9d760835043b99ee2b074..5cf9d098850aacd523322f8738587d0cba953fbe 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerextractmodulefiles_fuzzer/basebundleinstallerextractmodulefiles_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerextractmodulefiles_fuzzer/basebundleinstallerextractmodulefiles_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { { BaseBundleInstaller basebundleinstall; InnerBundleInfo info; - std::string modulePath; + std::string modulePath = std::string(data, size); std::string targetSoPath; std::string cpuAbi; auto ret1 = basebundleinstall.ExtractModuleFiles(info, modulePath, targetSoPath, cpuAbi); diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerinnerprocessbundleinstall_fuzzer/basebundleinstallerinnerprocessbundleinstall_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerinnerprocessbundleinstall_fuzzer/basebundleinstallerinnerprocessbundleinstall_fuzzer.cpp index f967fba2245689960971a465ab0371a8ebc606df..d545e242bf0eddb0092ae5510ecac205280f1380 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerinnerprocessbundleinstall_fuzzer/basebundleinstallerinnerprocessbundleinstall_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerinnerprocessbundleinstall_fuzzer/basebundleinstallerinnerprocessbundleinstall_fuzzer.cpp @@ -29,6 +29,7 @@ namespace OHOS { BaseBundleInstaller basebundleinstall; std::unordered_map newInfos; InnerBundleInfo oldInfo; + oldInfo.SetBundleInstallTime(reinterpret_cast(data)); const InstallParam installParam; int32_t uid = 0; auto ret1 = basebundleinstall.InnerProcessBundleInstall(newInfos, oldInfo, installParam, uid); diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerinnerprocessinstallbypreinstallinfo_fuzzer/basebundleinstallerinnerprocessinstallbypreinstallinfo_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerinnerprocessinstallbypreinstallinfo_fuzzer/basebundleinstallerinnerprocessinstallbypreinstallinfo_fuzzer.cpp index a6db380b3a93f76b6c229906d82554cd5f04a643..09a2a9e67ef8c0bfa2d529333083ea478cb38bb8 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerinnerprocessinstallbypreinstallinfo_fuzzer/basebundleinstallerinnerprocessinstallbypreinstallinfo_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerinnerprocessinstallbypreinstallinfo_fuzzer/basebundleinstallerinnerprocessinstallbypreinstallinfo_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) { BaseBundleInstaller basebundleinstall; - std::string bundleName; + std::string bundleName = std::string(data, size); InstallParam installParam; int32_t uid = 0; auto ret1 = basebundleinstall.InnerProcessInstallByPreInstallInfo(bundleName, installParam, uid); diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerinstallbundle_fuzzer/basebundleinstallerinstallbundle_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerinstallbundle_fuzzer/basebundleinstallerinstallbundle_fuzzer.cpp index 3878046b30226a3c705a918fbbf68aa054e77e38..e2098907752004cf92be331eff24facfed8b8851 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerinstallbundle_fuzzer/basebundleinstallerinstallbundle_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerinstallbundle_fuzzer/basebundleinstallerinstallbundle_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) { BaseBundleInstaller basebundleinstall; - std::string bundlePath = "/data/app/el1/bundle"; + std::string bundlePath = std::string(data, size); InstallParam installParam; Constants::AppType appType = Constants::AppType::SYSTEM_APP; auto ret1 = basebundleinstall.InstallBundle(bundlePath, installParam, appType); diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerinstallbundlebybundlename_fuzzer/basebundleinstallerinstallbundlebybundlename_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerinstallbundlebybundlename_fuzzer/basebundleinstallerinstallbundlebybundlename_fuzzer.cpp index 6617319146a6f01fd4acf98a0aaf7d3de1a50577..f3dff1f9ed5700eba058bbc0d642b022ab202935 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerinstallbundlebybundlename_fuzzer/basebundleinstallerinstallbundlebybundlename_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerinstallbundlebybundlename_fuzzer/basebundleinstallerinstallbundlebybundlename_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) { BaseBundleInstaller basebundleinstall; - std::string bundleName; + std::string bundleName = std::string(data, size); InstallParam installParam; auto ret1 = basebundleinstall.InstallBundleByBundleName(bundleName, installParam); return true; diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerinstallbundlevector_fuzzer/basebundleinstallerinstallbundlevector_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerinstallbundlevector_fuzzer/basebundleinstallerinstallbundlevector_fuzzer.cpp index 503ff5a7a62bdb174c40873e2d7fc90a8b45a011..a6bfe4bae60444d1cf4e764222af189e988e336b 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerinstallbundlevector_fuzzer/basebundleinstallerinstallbundlevector_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerinstallbundlevector_fuzzer/basebundleinstallerinstallbundlevector_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) { BaseBundleInstaller basebundleinstall; - std::vector bundlePaths; + std::vector bundlePaths = {std::string(data, size)}; InstallParam installParam; Constants::AppType appType = Constants::AppType::SYSTEM_APP; auto ret1 = basebundleinstall.InstallBundle(bundlePaths, installParam, appType); diff --git a/test/fuzztest/fuzztest_others/basebundleinstallermarkprebundlesyeeventboottag_fuzzer/basebundleinstallermarkprebundlesyeeventboottag_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallermarkprebundlesyeeventboottag_fuzzer/basebundleinstallermarkprebundlesyeeventboottag_fuzzer.cpp index a0dbd4aad9478082440d56f6d8628de41072fcee..42704700a09aeaeca5ab2944280818b04fcd443b 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallermarkprebundlesyeeventboottag_fuzzer/basebundleinstallermarkprebundlesyeeventboottag_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallermarkprebundlesyeeventboottag_fuzzer/basebundleinstallermarkprebundlesyeeventboottag_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) { BaseBundleInstaller basebundleinstall; - bool isBootScene = true; + bool isBootScene = reinterpret_cast(data) % 2; basebundleinstall.MarkPreBundleSyeEventBootTag(isBootScene); return true; } diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleinstall_fuzzer/basebundleinstallerprocessbundleinstall_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleinstall_fuzzer/basebundleinstallerprocessbundleinstall_fuzzer.cpp index 0ddfe02aec999e84395702c3cf07f39d8a39e780..5a85ecd3d8663003eb6aa25e8c4d0bdd5c1b3b85 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleinstall_fuzzer/basebundleinstallerprocessbundleinstall_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleinstall_fuzzer/basebundleinstallerprocessbundleinstall_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) { BaseBundleInstaller basebundleinstall; - std::vector bundlePaths; + std::vector bundlePaths = {std::string(data, size)}; InstallParam installParam; Constants::AppType appType = Constants::AppType::SYSTEM_APP; int32_t uid = 0; diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleinstallnative_fuzzer/basebundleinstallerprocessbundleinstallnative_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleinstallnative_fuzzer/basebundleinstallerprocessbundleinstallnative_fuzzer.cpp index 356dbb68a09431261a85051b0088a3e9ebdbc3ef..eb539af5b004db635c7f4ee1e9f9ca34db827b8a 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleinstallnative_fuzzer/basebundleinstallerprocessbundleinstallnative_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleinstallnative_fuzzer/basebundleinstallerprocessbundleinstallnative_fuzzer.cpp @@ -28,6 +28,7 @@ namespace OHOS { { BaseBundleInstaller basebundleinstall; InnerBundleInfo info; + info.SetBundleInstallTime(reinterpret_cast(data)); int32_t userId = 0; auto ret1 = basebundleinstall.ProcessBundleInstallNative(info, userId); return true; diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleinstallstatus_fuzzer/basebundleinstallerprocessbundleinstallstatus_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleinstallstatus_fuzzer/basebundleinstallerprocessbundleinstallstatus_fuzzer.cpp index 4a11e285e4b7c6abaa305edff31021f886e6b32d..22321ce428eea7dd3b5f4813660af65ee13c476c 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleinstallstatus_fuzzer/basebundleinstallerprocessbundleinstallstatus_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleinstallstatus_fuzzer/basebundleinstallerprocessbundleinstallstatus_fuzzer.cpp @@ -28,6 +28,7 @@ namespace OHOS { { BaseBundleInstaller basebundleinstall; InnerBundleInfo info; + info.SetBundleInstallTime(reinterpret_cast(data)); int32_t uid = 0; auto ret1 = basebundleinstall.ProcessBundleInstallStatus(info, uid); return true; diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleuninstall_fuzzer/basebundleinstallerprocessbundleuninstall_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleuninstall_fuzzer/basebundleinstallerprocessbundleuninstall_fuzzer.cpp index 29750539611ed19f8559c54ffaf248c96a261c44..07cc3c7948a18c5004832a9e59334ce486f6c4a0 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleuninstall_fuzzer/basebundleinstallerprocessbundleuninstall_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleuninstall_fuzzer/basebundleinstallerprocessbundleuninstall_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) { BaseBundleInstaller basebundleinstall; - std::string bundleName = ""; + std::string bundleName = std::string(data, size); std::string modulePackage = ""; InstallParam installParam; int32_t uid = 0; diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleuninstallnative_fuzzer/basebundleinstallerprocessbundleuninstallnative_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleuninstallnative_fuzzer/basebundleinstallerprocessbundleuninstallnative_fuzzer.cpp index 4c1d8d9b9282a9fd01aef96134195d169abcbb1d..b3512a61354fa4f75c35c69fd5ae1153135e6922 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleuninstallnative_fuzzer/basebundleinstallerprocessbundleuninstallnative_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleuninstallnative_fuzzer/basebundleinstallerprocessbundleuninstallnative_fuzzer.cpp @@ -29,7 +29,7 @@ namespace OHOS { BaseBundleInstaller basebundleinstall; InnerBundleInfo info; int32_t userId = 0; - std::string bundleName; + std::string bundleName = std::string(data, size); auto ret1 = basebundleinstall.ProcessBundleUnInstallNative(info, userId, bundleName); return true; } diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleupdatestatus_fuzzer/basebundleinstallerprocessbundleupdatestatus_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleupdatestatus_fuzzer/basebundleinstallerprocessbundleupdatestatus_fuzzer.cpp index bf652618af27214cd0651305d79a77aee1639757..28dbef753c574b07939f8a27d0a69e6458bbe0c9 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleupdatestatus_fuzzer/basebundleinstallerprocessbundleupdatestatus_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerprocessbundleupdatestatus_fuzzer/basebundleinstallerprocessbundleupdatestatus_fuzzer.cpp @@ -28,6 +28,7 @@ namespace OHOS { { BaseBundleInstaller basebundleinstall; InnerBundleInfo oldInfo; + oldInfo.SetBundleInstallTime(reinterpret_cast(data)); InnerBundleInfo newInfo; bool isReplace = true; auto ret1 = basebundleinstall.ProcessBundleUpdateStatus(oldInfo, newInfo, isReplace); diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerprocessinstallbundlebybundlename_fuzzer/basebundleinstallerprocessinstallbundlebybundlename_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerprocessinstallbundlebybundlename_fuzzer/basebundleinstallerprocessinstallbundlebybundlename_fuzzer.cpp index 055a9682773e330d7949014eb8086516eda0fef1..8d385af2363ca865aa8c6dee41ca35130f6cc383 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerprocessinstallbundlebybundlename_fuzzer/basebundleinstallerprocessinstallbundlebybundlename_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerprocessinstallbundlebybundlename_fuzzer/basebundleinstallerprocessinstallbundlebybundlename_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) { BaseBundleInstaller basebundleinstall; - std::string bundleName; + std::string bundleName = std::string(data, size); InstallParam installParam; int32_t uid = 0; auto ret1 = basebundleinstall.ProcessInstallBundleByBundleName(bundleName, installParam, uid); diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerprocessmoduleupdate_fuzzer/basebundleinstallerprocessmoduleupdate_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerprocessmoduleupdate_fuzzer/basebundleinstallerprocessmoduleupdate_fuzzer.cpp index c19c89f02afa1ca23f588cdf2c568df6869b6b21..5b170c4ec094e6d3ce8ef1ee7e5bbf848c2de517 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerprocessmoduleupdate_fuzzer/basebundleinstallerprocessmoduleupdate_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerprocessmoduleupdate_fuzzer/basebundleinstallerprocessmoduleupdate_fuzzer.cpp @@ -29,7 +29,7 @@ namespace OHOS { BaseBundleInstaller basebundleinstall; InnerBundleInfo newInfo; InnerBundleInfo oldInfo; - bool isReplace = true; + bool isReplace = reinterpret_cast(data) % 2; auto ret1 = basebundleinstall.ProcessModuleUpdate(newInfo, oldInfo, isReplace); return true; } diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerprocessrecover_fuzzer/basebundleinstallerprocessrecover_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerprocessrecover_fuzzer/basebundleinstallerprocessrecover_fuzzer.cpp index fd289dfe440f5d9a1666f9c9563e2c84eb73ed30..7648743bcda05a290bdf14ba1fbb5655adc85cc4 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerprocessrecover_fuzzer/basebundleinstallerprocessrecover_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerprocessrecover_fuzzer/basebundleinstallerprocessrecover_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) { BaseBundleInstaller basebundleinstall; - std::string bundleName; + std::string bundleName = std::string(data, size); InstallParam installParam; int32_t uid = 0; auto ret1 = basebundleinstall.ProcessRecover(bundleName, installParam, uid); diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerrecover_fuzzer/basebundleinstallerrecover_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerrecover_fuzzer/basebundleinstallerrecover_fuzzer.cpp index d24ce970617e6bd8422145900a780a9558467500..d09a2d276f47c203afe7873ebdaa32e25de01e0c 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerrecover_fuzzer/basebundleinstallerrecover_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerrecover_fuzzer/basebundleinstallerrecover_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) { BaseBundleInstaller basebundleinstall; - std::string bundleName; + std::string bundleName = std::string(data, size); InstallParam installParam; auto ret1 = basebundleinstall.Recover(bundleName, installParam); return true; diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerremovebundle_fuzzer/basebundleinstallerremovebundle_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerremovebundle_fuzzer/basebundleinstallerremovebundle_fuzzer.cpp index db5d81752fd1aabffa4f97ca2ceb49ba65046941..04e0ccd761923066008a22ca5473a083d282890c 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerremovebundle_fuzzer/basebundleinstallerremovebundle_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerremovebundle_fuzzer/basebundleinstallerremovebundle_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { { BaseBundleInstaller basebundleinstall; InnerBundleInfo info; - bool isKeepData = true; + bool isKeepData = reinterpret_cast(data) % 2; auto ret1 = basebundleinstall.RemoveBundle(info, isKeepData); return true; } diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerremovebundleanddatadir_fuzzer/basebundleinstallerremovebundleanddatadir_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerremovebundleanddatadir_fuzzer/basebundleinstallerremovebundleanddatadir_fuzzer.cpp index 3c43769aeb006f8398d48e35c8543b780c10f560..7cefabe4760fc9640f0f9f62d4ea5b7111ee1bdd 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerremovebundleanddatadir_fuzzer/basebundleinstallerremovebundleanddatadir_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerremovebundleanddatadir_fuzzer/basebundleinstallerremovebundleanddatadir_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { { BaseBundleInstaller basebundleinstall; InnerBundleInfo info; - bool isKeepData = true; + bool isKeepData = reinterpret_cast(data) % 2; auto ret1 = basebundleinstall.RemoveBundleAndDataDir(info, isKeepData); return true; } diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerremovemoduleanddatadir_fuzzer/basebundleinstallerremovemoduleanddatadir_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerremovemoduleanddatadir_fuzzer/basebundleinstallerremovemoduleanddatadir_fuzzer.cpp index 896c026b6001e3052d8964ada75ed75032330ad0..05f524feb4c9440b6de6011b618eacc9d674f72e 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerremovemoduleanddatadir_fuzzer/basebundleinstallerremovemoduleanddatadir_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerremovemoduleanddatadir_fuzzer/basebundleinstallerremovemoduleanddatadir_fuzzer.cpp @@ -30,7 +30,7 @@ namespace OHOS { InnerBundleInfo info; std::string modulePackage; int32_t userId = 0; - bool isKeepData = true; + bool isKeepData = reinterpret_cast(data) % 2; auto ret1 = basebundleinstall.RemoveModuleAndDataDir(info, modulePackage, userId, isKeepData); return true; } diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerremovemoduledir_fuzzer/basebundleinstallerremovemoduledir_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerremovemoduledir_fuzzer/basebundleinstallerremovemoduledir_fuzzer.cpp index 0bc42ca83db08aebfa1f2f4af46a98298528622b..f0ddd2b360ad359df6e459b10bd869c9c5716d42 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerremovemoduledir_fuzzer/basebundleinstallerremovemoduledir_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerremovemoduledir_fuzzer/basebundleinstallerremovemoduledir_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) { BaseBundleInstaller basebundleinstall; - std::string modulePath; + std::string modulePath = std::string(data, size); auto ret1 = basebundleinstall.RemoveModuleDir(modulePath); return true; } diff --git a/test/fuzztest/fuzztest_others/basebundleinstallerrenamemoduledir_fuzzer/basebundleinstallerrenamemoduledir_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallerrenamemoduledir_fuzzer/basebundleinstallerrenamemoduledir_fuzzer.cpp index e1b56c902a0e9945554a962c6ea1a29da59501a1..1589eed8017996c65e871bfbff6187bcf1b0604f 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallerrenamemoduledir_fuzzer/basebundleinstallerrenamemoduledir_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallerrenamemoduledir_fuzzer/basebundleinstallerrenamemoduledir_fuzzer.cpp @@ -28,6 +28,7 @@ namespace OHOS { { BaseBundleInstaller basebundleinstall; InnerBundleInfo info; + info.SetBundleInstallTime(reinterpret_cast(data)); auto ret1 = basebundleinstall.RenameModuleDir(info); return true; } diff --git a/test/fuzztest/fuzztest_others/basebundleinstallersetcheckresultmsg_fuzzer/basebundleinstallersetcheckresultmsg_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstallersetcheckresultmsg_fuzzer/basebundleinstallersetcheckresultmsg_fuzzer.cpp index df932ba4db221850424fc7e3016a27538dbf85ca..9dd216255b0a307ee1dc17291359e86b2b6e8588 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstallersetcheckresultmsg_fuzzer/basebundleinstallersetcheckresultmsg_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstallersetcheckresultmsg_fuzzer/basebundleinstallersetcheckresultmsg_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) { BaseBundleInstaller basebundleinstall; - std::string checkResultMsg; + std::string checkResultMsg = std::string(data, size); basebundleinstall.SetCheckResultMsg(checkResultMsg); return true; } diff --git a/test/fuzztest/fuzztest_others/basebundleinstalleruninstallbundle_fuzzer/basebundleinstalleruninstallbundle_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstalleruninstallbundle_fuzzer/basebundleinstalleruninstallbundle_fuzzer.cpp index 720f2b407c20968d1b670a9867f13364aa71e180..5aa47dc548888048d4f8ec1bc9c26b39d73f7aeb 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstalleruninstallbundle_fuzzer/basebundleinstalleruninstallbundle_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstalleruninstallbundle_fuzzer/basebundleinstalleruninstallbundle_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) { BaseBundleInstaller basebundleinstall; - std::string bundleName; + std::string bundleName = std::string(data, size); InstallParam installParam; auto ret1 = basebundleinstall.UninstallBundle(bundleName, installParam); return true; diff --git a/test/fuzztest/fuzztest_others/basebundleinstalleruninstallbundlebyuninstallparam_fuzzer/basebundleinstalleruninstallbundlebyuninstallparam_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstalleruninstallbundlebyuninstallparam_fuzzer/basebundleinstalleruninstallbundlebyuninstallparam_fuzzer.cpp index 1acc9e06e8a531f087329ad9c5fbdbe3c338812d..54db669a270aaee9f21fa7a933262100bd44142d 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstalleruninstallbundlebyuninstallparam_fuzzer/basebundleinstalleruninstallbundlebyuninstallparam_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstalleruninstallbundlebyuninstallparam_fuzzer/basebundleinstalleruninstallbundlebyuninstallparam_fuzzer.cpp @@ -28,6 +28,7 @@ namespace OHOS { { BaseBundleInstaller basebundleinstall; UninstallParam uninstallParam; + uninstallParam.bundleName = std::string(data, size); auto ret1 = basebundleinstall.UninstallBundleByUninstallParam(uninstallParam); return true; } diff --git a/test/fuzztest/fuzztest_others/basebundleinstalleruninstallbundlemodule_fuzzer/basebundleinstalleruninstallbundlemodule_fuzzer.cpp b/test/fuzztest/fuzztest_others/basebundleinstalleruninstallbundlemodule_fuzzer/basebundleinstalleruninstallbundlemodule_fuzzer.cpp index da08b56b2c17e9e5bddcf7884098be8f582d2767..28986981e814749710b7c58a6803d1f0f3c4ee43 100644 --- a/test/fuzztest/fuzztest_others/basebundleinstalleruninstallbundlemodule_fuzzer/basebundleinstalleruninstallbundlemodule_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/basebundleinstalleruninstallbundlemodule_fuzzer/basebundleinstalleruninstallbundlemodule_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) { BaseBundleInstaller basebundleinstall; - std::string bundleName; + std::string bundleName = std::string(data, size); std::string modulePackage; InstallParam installParam; auto ret1 = basebundleinstall.UninstallBundle(bundleName, modulePackage, installParam); diff --git a/test/fuzztest/fuzztest_others/beforeaddextresource_fuzzer/beforeaddextresource_fuzzer.cpp b/test/fuzztest/fuzztest_others/beforeaddextresource_fuzzer/beforeaddextresource_fuzzer.cpp index 391644c4dd7dbc2a262f06a0b1655632cc7f336f..aaf53d8170e4c640c1bc0bbfe7d9f99eca933b14 100644 --- a/test/fuzztest/fuzztest_others/beforeaddextresource_fuzzer/beforeaddextresource_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/beforeaddextresource_fuzzer/beforeaddextresource_fuzzer.cpp @@ -28,7 +28,7 @@ namespace { bool fuzzelBeforeAddExtResourceCaseOne(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; - std::vector filePaths; + std::vector filePaths = {std::string(reinterpret_cast(data), size)}; auto ret = impl.BeforeAddExtResource(EMPTY_STRING, filePaths); if (ret == ERR_OK) { return true; @@ -39,7 +39,7 @@ namespace { bool fuzzelBeforeAddExtResourceCaseTwo(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; - std::vector filePaths; + std::vector filePaths = {std::string(reinterpret_cast(data), size)}; auto ret = impl.BeforeAddExtResource(BUNDLE_NAME, filePaths); if (ret == ERR_OK) { return true; @@ -50,7 +50,7 @@ namespace { bool fuzzelBeforeAddExtResourceCaseThree(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; - std::vector filePaths; + std::vector filePaths = {std::string(reinterpret_cast(data), size)}; filePaths.emplace_back(FILE_PATH); filePaths.emplace_back(INVALID_PATH); auto ret = impl.BeforeAddExtResource(BUNDLE_NAME, filePaths); diff --git a/test/fuzztest/fuzztest_others/bmskeyeventmgr_fuzzer/bmskeyeventmgr_fuzzer.cpp b/test/fuzztest/fuzztest_others/bmskeyeventmgr_fuzzer/bmskeyeventmgr_fuzzer.cpp index 17c1a09093aa156ead4cbebf08a77a448ec32047..d4a0c83c5e36019972374c109c8c5c82601b2f34 100644 --- a/test/fuzztest/fuzztest_others/bmskeyeventmgr_fuzzer/bmskeyeventmgr_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/bmskeyeventmgr_fuzzer/bmskeyeventmgr_fuzzer.cpp @@ -26,7 +26,7 @@ constexpr size_t U32_AT_SIZE = 4; bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { BmsKeyEventMgr::ProcessMainBundleStatusFinally(); - BmsKeyEventMgr::ProcessMainBundleInstallFailed("", 0); + BmsKeyEventMgr::ProcessMainBundleInstallFailed(std::string(data, size), 0); return true; } } // namespace OHOS diff --git a/test/fuzztest/fuzztest_others/bundleagingmgr_fuzzer/bundleagingmgr_fuzzer.cpp b/test/fuzztest/fuzztest_others/bundleagingmgr_fuzzer/bundleagingmgr_fuzzer.cpp index 0b296af1f9188cf55491f93d12d3bbcd7ccfacb7..9dfffa6dfd53a844969cd2babbbaa9b11c4c7f28 100644 --- a/test/fuzztest/fuzztest_others/bundleagingmgr_fuzzer/bundleagingmgr_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/bundleagingmgr_fuzzer/bundleagingmgr_fuzzer.cpp @@ -26,7 +26,9 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { auto bundleAgingMgr = std::make_shared(); std::shared_ptr dataMgr = nullptr; - bundleAgingMgr->Start(BundleAgingMgr::AgingTriggertype::FREE_INSTALL); + BundleAgingMgr::AgingTriggertype triggerType = reinterpret_cast(data) % 2 ? + BundleAgingMgr::AgingTriggertype::FREE_INSTALL : BundleAgingMgr::AgingTriggertype::UPDATE_REMOVABLE_FLAG; + bundleAgingMgr->Start(triggerType); bundleAgingMgr->InitAgingtTimer(); bundleAgingMgr->ResetRequest(); bundleAgingMgr->IsReachStartAgingThreshold(); diff --git a/test/fuzztest/fuzztest_others/bundlemanagercallback_fuzzer/bundlemanagercallback_fuzzer.cpp b/test/fuzztest/fuzztest_others/bundlemanagercallback_fuzzer/bundlemanagercallback_fuzzer.cpp index f92a012d847dd5a3b7c8e91fa05b1c9da5787377..592e6516072959aa08d1831cfe016227e9126a95 100644 --- a/test/fuzztest/fuzztest_others/bundlemanagercallback_fuzzer/bundlemanagercallback_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/bundlemanagercallback_fuzzer/bundlemanagercallback_fuzzer.cpp @@ -29,7 +29,6 @@ constexpr size_t MESSAGE_SIZE = 21; constexpr size_t DCAMERA_SHIFT_24 = 24; constexpr size_t DCAMERA_SHIFT_16 = 16; constexpr size_t DCAMERA_SHIFT_8 = 8; -std::string INSTALL_RESULT = "installResult"; uint32_t GetU32Data(const char* ptr) { return (ptr[0] << DCAMERA_SHIFT_24) | (ptr[1] << DCAMERA_SHIFT_16) | (ptr[2] << DCAMERA_SHIFT_8) | (ptr[3]); @@ -39,7 +38,7 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) auto server = std::make_shared(); std::weak_ptr serverWptr = server; BundleManagerCallback bundleManagerCallback(serverWptr); - std::string installResult = INSTALL_RESULT; + std::string installResult = std::string(data, size); bundleManagerCallback.OnQueryRpcIdFinished(installResult); return true; } diff --git a/test/fuzztest/fuzztest_others/bundleresconfiguration_fuzzer/bundleresconfiguration_fuzzer.cpp b/test/fuzztest/fuzztest_others/bundleresconfiguration_fuzzer/bundleresconfiguration_fuzzer.cpp index 5edaa89a9bbfc32a07e33b86056c6cac8d2c40d2..94429604207a325ed6bb70927f0eb02d41d0d3a4 100644 --- a/test/fuzztest/fuzztest_others/bundleresconfiguration_fuzzer/bundleresconfiguration_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/bundleresconfiguration_fuzzer/bundleresconfiguration_fuzzer.cpp @@ -30,7 +30,7 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) std::shared_ptr resourceManager(Global::Resource::CreateResourceManager()); BundleResourceConfiguration::InitResourceGlobalConfig(resourceManager); BundleResourceConfiguration::InitResourceGlobalConfig(HAP_FILE_PATH1, resourceManager); - std::vector overlayHaps; + std::vector overlayHaps = {std::string(data, size)}; overlayHaps.emplace_back(HAP_FILE_PATH1); BundleResourceConfiguration::InitResourceGlobalConfig(HAP_FILE_PATH1, overlayHaps, resourceManager); return true; diff --git a/test/fuzztest/fuzztest_others/bundleresdrawable_fuzzer/bundleresdrawable_fuzzer.cpp b/test/fuzztest/fuzztest_others/bundleresdrawable_fuzzer/bundleresdrawable_fuzzer.cpp index 2b7b02fba7d13e3565c15188ec9aafddadf32fb5..961b11e14dad45cbeffb2894e31516e7bc1cd555 100644 --- a/test/fuzztest/fuzztest_others/bundleresdrawable_fuzzer/bundleresdrawable_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/bundleresdrawable_fuzzer/bundleresdrawable_fuzzer.cpp @@ -30,7 +30,7 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { BundleResourceDrawable drawable; uint32_t iconId = 1; - int32_t density = 1; + int32_t density = static_cast(GetU32Data(data)); ResourceInfo resourceInfo; drawable.GetIconResourceByTheme(iconId, density, nullptr, resourceInfo); std::shared_ptr resourceManager(Global::Resource::CreateResourceManager()); diff --git a/test/fuzztest/fuzztest_others/checkfileparam_fuzzer/checkfileparam_fuzzer.cpp b/test/fuzztest/fuzztest_others/checkfileparam_fuzzer/checkfileparam_fuzzer.cpp index ab27d25c4c3e558d56648622fd872e9436411106..5922a8e62c3b0c97ff4f1fe00d3b4c25b5fafcbc 100644 --- a/test/fuzztest/fuzztest_others/checkfileparam_fuzzer/checkfileparam_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/checkfileparam_fuzzer/checkfileparam_fuzzer.cpp @@ -27,6 +27,7 @@ namespace { bool fuzzelCheckFileParamCaseOne(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; + impl.MkdirIfNotExist(std::string(reinterpret_cast(data), size)); auto ret = impl.CheckFileParam(INVALID_PATH); if (ret == ERR_OK) { return true; @@ -37,6 +38,7 @@ namespace { bool fuzzelCheckFileParamCaseTwo(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; + impl.MkdirIfNotExist(std::string(reinterpret_cast(data), size)); auto ret = impl.CheckFileParam(INVALID_SUFFIX); if (ret == ERR_OK) { return true; @@ -47,6 +49,7 @@ namespace { bool fuzzelCheckFileParamCaseThree(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; + impl.MkdirIfNotExist(std::string(reinterpret_cast(data), size)); auto ret = impl.CheckFileParam(INVALID_PREFIX); if (ret == ERR_OK) { return true; diff --git a/test/fuzztest/fuzztest_others/checkmoduleexist_fuzzer/checkmoduleexist_fuzzer.cpp b/test/fuzztest/fuzztest_others/checkmoduleexist_fuzzer/checkmoduleexist_fuzzer.cpp index 79555f68ca0321f9a410a1b32956cc92acade0bd..ef2eaa00e51ad1e5acf77f9403b8f8bb1b3309d8 100644 --- a/test/fuzztest/fuzztest_others/checkmoduleexist_fuzzer/checkmoduleexist_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/checkmoduleexist_fuzzer/checkmoduleexist_fuzzer.cpp @@ -26,7 +26,7 @@ namespace { { ExtendResourceManagerHostImpl impl; std::string emptyBundleName; - std::vector moduleNames; + std::vector moduleNames = {std::string(reinterpret_cast(data), size)}; std::vector extendResourceInfos; auto ret = impl.CheckModuleExist(TEST_BUNDLE, moduleNames, extendResourceInfos); if (ret != ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST) { diff --git a/test/fuzztest/fuzztest_others/commonevent_fuzzer/commonevent_fuzzer.cpp b/test/fuzztest/fuzztest_others/commonevent_fuzzer/commonevent_fuzzer.cpp index 300a8d25f30486f0149b2ae4dffc871ece3168ac..c15c8c525f36172446e40c5edc39a4af1ebd7306 100644 --- a/test/fuzztest/fuzztest_others/commonevent_fuzzer/commonevent_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/commonevent_fuzzer/commonevent_fuzzer.cpp @@ -23,6 +23,7 @@ namespace OHOS { { Parcel dataMessageParcel; CommonEventInfo oldCommonEventInfo; + oldCommonEventInfo.name = std::string(reinterpret_cast(data), size); if (!oldCommonEventInfo.Marshalling(dataMessageParcel)) { return false; } diff --git a/test/fuzztest/fuzztest_others/copytotempdir_fuzzer/copytotempdir_fuzzer.cpp b/test/fuzztest/fuzztest_others/copytotempdir_fuzzer/copytotempdir_fuzzer.cpp index cc7bcafb5a889000b2533ef9323286bb582378be..280cbdb23bb63818e538756951d845a6cad13559 100644 --- a/test/fuzztest/fuzztest_others/copytotempdir_fuzzer/copytotempdir_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/copytotempdir_fuzzer/copytotempdir_fuzzer.cpp @@ -29,7 +29,7 @@ namespace { ExtendResourceManagerHostImpl impl; std::vector oldFilePaths; oldFilePaths.push_back(FILE_PATH); - std::vector newFilePaths; + std::vector newFilePaths = {std::string(reinterpret_cast(data), size)}; newFilePaths.push_back(DIR_PATH_TWO); auto ret = impl.CopyToTempDir(BUNDLE_NAME, oldFilePaths, newFilePaths); if (ret == ERR_OK) { diff --git a/test/fuzztest/fuzztest_others/createfd_fuzzer/createfd_fuzzer.cpp b/test/fuzztest/fuzztest_others/createfd_fuzzer/createfd_fuzzer.cpp index 0af620dde9bbcb37543800164e3dfed1ef83f1db..36b39d45b93cce13d490ff50dce1be2cf6a05ebb 100644 --- a/test/fuzztest/fuzztest_others/createfd_fuzzer/createfd_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/createfd_fuzzer/createfd_fuzzer.cpp @@ -20,8 +20,6 @@ using namespace OHOS::AppExecFwk; namespace { const int32_t FD = 0; const std::string FILE_PATH = "data/test"; - const std::string EMPTY_STRING = ""; - const std::string TEST_BUNDLE = "com.test.ext.resource"; } namespace OHOS { @@ -30,7 +28,7 @@ namespace OHOS { ExtendResourceManagerHostImpl impl; int32_t fd = FD; std::string path = FILE_PATH; - auto ret = impl.CreateFd(TEST_BUNDLE, fd, path); + auto ret = impl.CreateFd(std::string(reinterpret_cast(data), size), fd, path); if (ret == ERR_OK) { return true; } @@ -42,7 +40,7 @@ namespace OHOS { ExtendResourceManagerHostImpl impl; int32_t fd = FD; std::string path = FILE_PATH; - auto ret = impl.CreateFd(EMPTY_STRING, fd, path); + auto ret = impl.CreateFd(std::string(reinterpret_cast(data), size), fd, path); if (ret == ERR_OK) { return true; } diff --git a/test/fuzztest/fuzztest_others/disabledynamicicon_fuzzer/disabledynamicicon_fuzzer.cpp b/test/fuzztest/fuzztest_others/disabledynamicicon_fuzzer/disabledynamicicon_fuzzer.cpp index 6ba551188f28d6dc1e7cb2ec38f2c964c3b49c12..ea9488b5aa36a200930962e760142916674b6dc0 100644 --- a/test/fuzztest/fuzztest_others/disabledynamicicon_fuzzer/disabledynamicicon_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/disabledynamicicon_fuzzer/disabledynamicicon_fuzzer.cpp @@ -25,8 +25,8 @@ namespace { bool fuzzelDisableDynamicIconCaseOne(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; - std::string emptyStr; - auto ret = impl.DisableDynamicIcon(emptyStr); + std::string bundleName (reinterpret_cast(data), size); + auto ret = impl.DisableDynamicIcon(bundleName); if (ret == ERR_OK) { return true; } diff --git a/test/fuzztest/fuzztest_others/elementname_fuzzer/elementname_fuzzer.cpp b/test/fuzztest/fuzztest_others/elementname_fuzzer/elementname_fuzzer.cpp index 7ba80a80b71a4968f8d82bb4815e0769abdc4d04..58b189151383afc980453973e84123903474bbc1 100644 --- a/test/fuzztest/fuzztest_others/elementname_fuzzer/elementname_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/elementname_fuzzer/elementname_fuzzer.cpp @@ -24,6 +24,7 @@ namespace OHOS { { Parcel dataMessageParcel; ElementName oldElementName; + oldElementName.SetDeviceID(std::string(reinterpret_cast(data), size)); if (!oldElementName.Marshalling(dataMessageParcel)) { return false; } diff --git a/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/filenamevalid_fuzzer.cpp b/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/filenamevalid_fuzzer.cpp index 5ae275046f1dc389b796c56df55be4b99bd3e09e..748dd31cf8e7edb6a6a7b68582c93ad3a7d91532 100644 --- a/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/filenamevalid_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/filenamevalid_fuzzer/filenamevalid_fuzzer.cpp @@ -20,7 +20,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; - std::vector filePaths; + std::vector filePaths = {std::string(reinterpret_cast(data), size)}; std::string emptyBundleName; auto ret = impl.AddExtResource(emptyBundleName, filePaths); if (ret == ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST) { diff --git a/test/fuzztest/fuzztest_others/getdynamicicon_fuzzer/getdynamicicon_fuzzer.cpp b/test/fuzztest/fuzztest_others/getdynamicicon_fuzzer/getdynamicicon_fuzzer.cpp index f0beea5cda464b64175ee00e172bd353f892129c..a323d4b559ddc93262f0e26503130fabc5d18a8c 100644 --- a/test/fuzztest/fuzztest_others/getdynamicicon_fuzzer/getdynamicicon_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/getdynamicicon_fuzzer/getdynamicicon_fuzzer.cpp @@ -26,7 +26,7 @@ namespace { { ExtendResourceManagerHostImpl impl; std::string emptyStr; - std::string moudleName; + std::string moudleName = std::string(reinterpret_cast(data), size); auto ret = impl.GetDynamicIcon(emptyStr, moudleName); if (ret == ERR_OK) { return true; @@ -37,7 +37,7 @@ namespace { bool fuzzelGetDynamicIconCaseTwo(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; - std::string moudleName; + std::string moudleName = std::string(reinterpret_cast(data), size); auto ret = impl.GetDynamicIcon(TEST_BUNDLE, moudleName); if (ret == ERR_OK) { return true; diff --git a/test/fuzztest/fuzztest_others/getinnerbundleinfo_fuzzer/getinnerbundleinfo_fuzzer.cpp b/test/fuzztest/fuzztest_others/getinnerbundleinfo_fuzzer/getinnerbundleinfo_fuzzer.cpp index cee9410d31d00a912a89a078d2f09a99f02f09ce..b61e2ef000de43802feebccfc51f989b21642522 100644 --- a/test/fuzztest/fuzztest_others/getinnerbundleinfo_fuzzer/getinnerbundleinfo_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/getinnerbundleinfo_fuzzer/getinnerbundleinfo_fuzzer.cpp @@ -19,14 +19,11 @@ using namespace OHOS::AppExecFwk; namespace OHOS { -namespace { - const std::string BUNDLE_NAME2 = "com.ohos.mms"; -} bool fuzzelGetInnerBundleInfoCaseOne(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; InnerBundleInfo info; - bool ret = impl.GetInnerBundleInfo(BUNDLE_NAME2, info); + bool ret = impl.GetInnerBundleInfo(std::string(reinterpret_cast(data), size), info); if (ret == ERR_OK) { return true; } diff --git a/test/fuzztest/fuzztest_others/innereventreport_fuzzer/innereventreport_fuzzer.cpp b/test/fuzztest/fuzztest_others/innereventreport_fuzzer/innereventreport_fuzzer.cpp index 3b158b98149247a9f72d4ca897d6c7d7f4f4a183..ffd909045b71c7593e41d8f343575db3d4f8c267 100644 --- a/test/fuzztest/fuzztest_others/innereventreport_fuzzer/innereventreport_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/innereventreport_fuzzer/innereventreport_fuzzer.cpp @@ -29,6 +29,7 @@ constexpr uint8_t CODE_MAX = 22; bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { EventInfo eventInfo; + eventInfo.abilityName = std::string(reinterpret_cast(data), size); for (uint8_t code = 0; code <= CODE_MAX; code++) { InnerEventReport::SendSystemEvent(BMSEventType(code), eventInfo); } diff --git a/test/fuzztest/fuzztest_others/innersaveextendresourceinfo_fuzzer/innersaveextendresourceinfo_fuzzer.cpp b/test/fuzztest/fuzztest_others/innersaveextendresourceinfo_fuzzer/innersaveextendresourceinfo_fuzzer.cpp index c34978134e095df8fb778fe95bb4fba355b8a808..4721bdbdb3e54738f3bee1097b256631c4222243 100644 --- a/test/fuzztest/fuzztest_others/innersaveextendresourceinfo_fuzzer/innersaveextendresourceinfo_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/innersaveextendresourceinfo_fuzzer/innersaveextendresourceinfo_fuzzer.cpp @@ -22,7 +22,7 @@ namespace OHOS { bool fuzzelInnerSaveExtendResourceInfoCaseOne(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; - std::vector filePaths; + std::vector filePaths = {std::string(reinterpret_cast(data), size)}; std::string emptyBundleName; auto ret = impl.AddExtResource(emptyBundleName, filePaths); if (ret != ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST) { diff --git a/test/fuzztest/fuzztest_others/installparamunmarshalling_fuzzer/installparamunmarshalling_fuzzer.cpp b/test/fuzztest/fuzztest_others/installparamunmarshalling_fuzzer/installparamunmarshalling_fuzzer.cpp index f1661954fce22bf9ff69da213de060d2b25ad6d6..c8861294b120e6e353b23d8fa1715c8496756d8d 100644 --- a/test/fuzztest/fuzztest_others/installparamunmarshalling_fuzzer/installparamunmarshalling_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/installparamunmarshalling_fuzzer/installparamunmarshalling_fuzzer.cpp @@ -25,6 +25,7 @@ namespace OHOS { { Parcel dataMessageParcel; InstallParam oldInstallParam; + oldInstallParam.additionalInfo = std::string(reinterpret_cast(data), size); if (!oldInstallParam.Marshalling(dataMessageParcel)) { return false; } diff --git a/test/fuzztest/fuzztest_others/mkdirifnotexist_fuzzer/mkdirifnotexist_fuzzer.cpp b/test/fuzztest/fuzztest_others/mkdirifnotexist_fuzzer/mkdirifnotexist_fuzzer.cpp index bf87fbfbd29c6fb2b27ba082dd54c6e7bed8decc..f8eb3c03828b9420e75c2d0b277f69adf4f238d6 100644 --- a/test/fuzztest/fuzztest_others/mkdirifnotexist_fuzzer/mkdirifnotexist_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/mkdirifnotexist_fuzzer/mkdirifnotexist_fuzzer.cpp @@ -21,7 +21,6 @@ using namespace OHOS::AppExecFwk; namespace OHOS { namespace { const std::string DIR_PATH_ONE = "/data/service/el1"; - const std::string DIR_PATH_TWO = "/data/test/test"; } bool fuzzelMkDirIfNotExistCaseOne(const uint8_t* data, size_t size) { @@ -30,7 +29,7 @@ namespace { if (ret != ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR) { return false; } - ret = impl.MkdirIfNotExist(DIR_PATH_TWO); + ret = impl.MkdirIfNotExist(std::string(reinterpret_cast(data), size)); if (ret != ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR) { return false; } diff --git a/test/fuzztest/fuzztest_others/parsebundleresource_fuzzer/parsebundleresource_fuzzer.cpp b/test/fuzztest/fuzztest_others/parsebundleresource_fuzzer/parsebundleresource_fuzzer.cpp index 94ee86efebfbfc801035c4c16e9dc0b1e0431b1c..c1881d05aa5aee7d1811ac22c1a079ce0014932c 100644 --- a/test/fuzztest/fuzztest_others/parsebundleresource_fuzzer/parsebundleresource_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/parsebundleresource_fuzzer/parsebundleresource_fuzzer.cpp @@ -20,13 +20,12 @@ using namespace OHOS::AppExecFwk; namespace OHOS { namespace { - const std::string BUNDLE_NAME = "com.ohos.resourcedemo"; } bool fuzzelParseBundleResourceCaseOne(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; ExtendResourceInfo extendResourceInfo; - if (!impl.ParseBundleResource(BUNDLE_NAME, extendResourceInfo)) { + if (!impl.ParseBundleResource(std::string(reinterpret_cast(data), size), extendResourceInfo)) { return false; } return true; diff --git a/test/fuzztest/fuzztest_others/parseextendresourcefile_fuzzer/parseextendresourcefile_fuzzer.cpp b/test/fuzztest/fuzztest_others/parseextendresourcefile_fuzzer/parseextendresourcefile_fuzzer.cpp index c418e3b8aeec5d0393a9a1fb88b3a5c551790a3f..1a85cd33dbccc382b65b8bc78b51dafcdb3e05de 100644 --- a/test/fuzztest/fuzztest_others/parseextendresourcefile_fuzzer/parseextendresourcefile_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/parseextendresourcefile_fuzzer/parseextendresourcefile_fuzzer.cpp @@ -26,7 +26,7 @@ namespace { bool fuzzelParseExtendResourceFileCaseOne(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; - std::vector filePaths; + std::vector filePaths = {std::string(reinterpret_cast(data), size)}; filePaths.emplace_back(FILE_PATH); std::vector extendResourceInfos; auto ret = impl.ParseExtendResourceFile(BUNDLE_NAME, filePaths, extendResourceInfos); diff --git a/test/fuzztest/fuzztest_others/quickfix_fuzzer/quickfix_fuzzer.cpp b/test/fuzztest/fuzztest_others/quickfix_fuzzer/quickfix_fuzzer.cpp index 27a8639bbd4c77add4ede78c6b25baad12a00de9..0adca5f724627f07c93e32c3828aa4e393bbfae3 100644 --- a/test/fuzztest/fuzztest_others/quickfix_fuzzer/quickfix_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/quickfix_fuzzer/quickfix_fuzzer.cpp @@ -32,7 +32,7 @@ bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) bundleFilePaths.push_back(bundleFilePath); bool isDebug = false; std::string targetPath; - std::string bundleName; + std::string bundleName = std::string(reinterpret_cast(data), size); bool enable = false; sptr statusCallback; QuickFixer quickFixMgr_(statusCallback); diff --git a/test/fuzztest/fuzztest_others/quickfixchecker_fuzzer/quickfixchecker_fuzzer.cpp b/test/fuzztest/fuzztest_others/quickfixchecker_fuzzer/quickfixchecker_fuzzer.cpp index 678a4521188ca8438d5ceb689fdae7376d6a911d..e532fb913534f5d69a94e85566665e3a87887fc7 100644 --- a/test/fuzztest/fuzztest_others/quickfixchecker_fuzzer/quickfixchecker_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/quickfixchecker_fuzzer/quickfixchecker_fuzzer.cpp @@ -57,7 +57,7 @@ AppQuickFix CreateAppQuickFix() bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { QuickFixChecker quickFixChecker; - std::vector bundlePaths; + std::vector bundlePaths = {std::string(data, size)}; std::vector hapVerifyRes; quickFixChecker.CheckMultipleHqfsSignInfo(bundlePaths, hapVerifyRes); std::unordered_map infos; diff --git a/test/fuzztest/fuzztest_others/quickfixmgr_fuzzer/quickfixmgr_fuzzer.cpp b/test/fuzztest/fuzztest_others/quickfixmgr_fuzzer/quickfixmgr_fuzzer.cpp index 036e0de21d86d30331eca59b8c88bf87854e61f9..44a5fb1e19a562b802ee39b26bcb6bc686321812 100644 --- a/test/fuzztest/fuzztest_others/quickfixmgr_fuzzer/quickfixmgr_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/quickfixmgr_fuzzer/quickfixmgr_fuzzer.cpp @@ -33,7 +33,7 @@ bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) sptr statusCallback; bool isDebug = false; std::string targetPath; - std::string bundleName; + std::string bundleName = std::string(reinterpret_cast(data), size); bool enable = false; auto quickFixMgr = std::make_shared(); quickFixMgr->DeployQuickFix(bundleFilePaths, statusCallback, isDebug, targetPath); diff --git a/test/fuzztest/fuzztest_others/quickfixswitcher_fuzzer/quickfixswitcher_fuzzer.cpp b/test/fuzztest/fuzztest_others/quickfixswitcher_fuzzer/quickfixswitcher_fuzzer.cpp index 8707d7251a2624d914a4725b230833b2af56f5eb..4aa3f65476e319c667c5ac460f02af0ac549b722 100644 --- a/test/fuzztest/fuzztest_others/quickfixswitcher_fuzzer/quickfixswitcher_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/quickfixswitcher_fuzzer/quickfixswitcher_fuzzer.cpp @@ -25,7 +25,6 @@ constexpr size_t U32_AT_SIZE = 4; constexpr size_t DCAMERA_SHIFT_24 = 24; constexpr size_t DCAMERA_SHIFT_16 = 16; constexpr size_t DCAMERA_SHIFT_8 = 8; -const std::string BUNDLE_NAME = "com.example.l3jsdemo"; uint32_t GetU32Data(const char* ptr) { @@ -33,7 +32,7 @@ uint32_t GetU32Data(const char* ptr) } bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { - std::string bundleName = BUNDLE_NAME; + std::string bundleName = std::string(data, size); QuickFixSwitcher quickFixSwitcher(bundleName, true); quickFixSwitcher.Execute(); quickFixSwitcher.SwitchQuickFix(); diff --git a/test/fuzztest/fuzztest_others/removeextresourcesdb_fuzzer/removeextresourcesdb_fuzzer.cpp b/test/fuzztest/fuzztest_others/removeextresourcesdb_fuzzer/removeextresourcesdb_fuzzer.cpp index d9ac977fc749c44d703bf9562995e70c4b9564a6..9a9dfe4fe946d4889669ef1de255e673310f1c88 100644 --- a/test/fuzztest/fuzztest_others/removeextresourcesdb_fuzzer/removeextresourcesdb_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/removeextresourcesdb_fuzzer/removeextresourcesdb_fuzzer.cpp @@ -22,7 +22,6 @@ namespace OHOS { namespace { const std::string DIR_PATH_ONE = "/data/service/el1"; const std::string DIR_PATH_TWO = "/data/test/test"; - const std::string TEST_MODULE = "testModule"; const std::string BUNDLE_NAME = "com.ohos.resourcedemo"; } bool fuzzelRemoveExtResourcesDbCaseOne(const uint8_t* data, size_t size) @@ -37,7 +36,7 @@ namespace { return false; } std::vector moduleNames; - moduleNames.push_back(TEST_MODULE); + moduleNames.push_back(std::string(reinterpret_cast(data), size)); ret = impl.RemoveExtResourcesDb(BUNDLE_NAME, moduleNames); return ret; } diff --git a/test/fuzztest/fuzztest_others/resetbundleresourceicon_fuzzer/resetbundleresourceicon_fuzzer.cpp b/test/fuzztest/fuzztest_others/resetbundleresourceicon_fuzzer/resetbundleresourceicon_fuzzer.cpp index 3a26d41e31fb7ba4bc8f01ada549c0d0e6c25e69..5061741cb523dbbbfb6f8b4b8b95044c1c6ba8b0 100644 --- a/test/fuzztest/fuzztest_others/resetbundleresourceicon_fuzzer/resetbundleresourceicon_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/resetbundleresourceicon_fuzzer/resetbundleresourceicon_fuzzer.cpp @@ -19,13 +19,10 @@ using namespace OHOS::AppExecFwk; namespace OHOS { -namespace { - const std::string BUNDLE_NAME2 = "com.ohos.mms"; -} bool fuzzelResetBundleResourceIconCaseOne(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; - bool ret = impl.ResetBundleResourceIcon(BUNDLE_NAME2); + bool ret = impl.ResetBundleResourceIcon(std::string(reinterpret_cast(data), size)); return ret; } } diff --git a/test/fuzztest/fuzztest_others/rollback_fuzzer/rollback_fuzzer.cpp b/test/fuzztest/fuzztest_others/rollback_fuzzer/rollback_fuzzer.cpp index 18fa21ce4ed3a1a357ee93a16cf24b40f03cd627..032901bf6e1abc0f2137ac84e3a0ad090403aafa 100644 --- a/test/fuzztest/fuzztest_others/rollback_fuzzer/rollback_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/rollback_fuzzer/rollback_fuzzer.cpp @@ -22,7 +22,6 @@ namespace OHOS { namespace { const std::string DIR_PATH_ONE = "/data/service/el1"; const std::string DIR_PATH_TWO = "/data/test/test"; - const std::string TEST_MODULE = "testModule"; const std::string FILE_PATH = "/data/service/el1/public/bms/bundle_manager_service/a.hsp"; const std::string BUNDLE_NAME = "com.ohos.resourcedemo"; } @@ -38,7 +37,7 @@ namespace { return false; } std::vector moduleNames; - moduleNames.push_back(TEST_MODULE); + moduleNames.push_back(std::string(reinterpret_cast(data), size)); ret = impl.RemoveExtResourcesDb(BUNDLE_NAME, moduleNames); if (ret != ERR_OK) { return false; diff --git a/test/fuzztest/fuzztest_others/routermaphelper_fuzzer/routermaphelper_fuzzer.cpp b/test/fuzztest/fuzztest_others/routermaphelper_fuzzer/routermaphelper_fuzzer.cpp index c669cb3410cd77aaa890e71d736e798335b919f5..239316c86dd7197288ebc53a65cd3dda808766a3 100644 --- a/test/fuzztest/fuzztest_others/routermaphelper_fuzzer/routermaphelper_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/routermaphelper_fuzzer/routermaphelper_fuzzer.cpp @@ -34,7 +34,7 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) RouterMapHelper::MergeRouter(info); RouterMapHelper::MergeRouter(routerArrayList, routerArray, moduleNameSet); std::string version1 = "1.0.0"; - std::string version2 = "2.0.0"; + std::string version2 = std::string(data, size); RouterMapHelper::Compare(version1, version2); SemVer semVer1(version1); SemVer semVer2(version2); diff --git a/test/fuzztest/fuzztest_others/savecurdynamicicon_fuzzer/savecurdynamicicon_fuzzer.cpp b/test/fuzztest/fuzztest_others/savecurdynamicicon_fuzzer/savecurdynamicicon_fuzzer.cpp index e2a4faa5facf495d294e72df828a858f87767509..b69db8225b49275d2be1a1e700904c3a2bc3c9b4 100644 --- a/test/fuzztest/fuzztest_others/savecurdynamicicon_fuzzer/savecurdynamicicon_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/savecurdynamicicon_fuzzer/savecurdynamicicon_fuzzer.cpp @@ -26,13 +26,13 @@ namespace { bool fuzzelSaveCurDynamicIconCaseOne(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; - impl.SaveCurDynamicIcon(BUNDLE_NAME2, TEST_MODULE); + impl.SaveCurDynamicIcon(std::string(reinterpret_cast(data), size), TEST_MODULE); return true; } bool fuzzelSaveCurDynamicIconCaseTwo(const uint8_t* data, size_t size) { ExtendResourceManagerHostImpl impl; - impl.SaveCurDynamicIcon(BUNDLE_NAME2, ""); + impl.SaveCurDynamicIcon(BUNDLE_NAME2, std::string(reinterpret_cast(data), size)); return true; } } diff --git a/test/fuzztest/fuzztest_others/sendbroadcast_fuzzer/sendbroadcast_fuzzer.cpp b/test/fuzztest/fuzztest_others/sendbroadcast_fuzzer/sendbroadcast_fuzzer.cpp index 7ac1d5adbdab4d043c0d77d28ba15baa0bb69767..2a36f0a17ed298d2ccb0dec9f486e1a5cd1fd9b4 100644 --- a/test/fuzztest/fuzztest_others/sendbroadcast_fuzzer/sendbroadcast_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/sendbroadcast_fuzzer/sendbroadcast_fuzzer.cpp @@ -17,15 +17,13 @@ #include "sendbroadcast_fuzzer.h" using namespace OHOS::AppExecFwk; - namespace OHOS { -namespace { - const std::string BUNDLE_NAME = "com.ohos.resourcedemo"; -} + bool fuzzelSendBroadCastCaseOne(const uint8_t* data, size_t size) { + std::string bundleName (reinterpret_cast(data), size); ExtendResourceManagerHostImpl impl; - impl.SendBroadcast(BUNDLE_NAME, false); + impl.SendBroadcast(bundleName, false); return true; } } diff --git a/test/fuzztest/fuzztest_others/shortcutdatastoragerdb_fuzzer/shortcutdatastoragerdb_fuzzer.cpp b/test/fuzztest/fuzztest_others/shortcutdatastoragerdb_fuzzer/shortcutdatastoragerdb_fuzzer.cpp index 16695727179d8ccaa6b498819ad3be362c67f560..539e183bdedd9b1af6318e672fd130bacc2b6012 100644 --- a/test/fuzztest/fuzztest_others/shortcutdatastoragerdb_fuzzer/shortcutdatastoragerdb_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/shortcutdatastoragerdb_fuzzer/shortcutdatastoragerdb_fuzzer.cpp @@ -29,7 +29,7 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) std::shared_ptr shortcutDataStorageRdb = std::make_shared(); ShortcutInfo shortcutInfo; shortcutInfo.id = "id_test1"; - shortcutInfo.bundleName = "com.ohos.hello"; + shortcutInfo.bundleName = std::string(data, size); shortcutInfo.hostAbility = "hostAbility"; shortcutInfo.icon = "$media:16777224"; shortcutInfo.label = "shortcutLabel"; diff --git a/test/fuzztest/fuzztest_others/updateextresourcesdb_fuzzer/updateextresourcesdb_fuzzer.cpp b/test/fuzztest/fuzztest_others/updateextresourcesdb_fuzzer/updateextresourcesdb_fuzzer.cpp index dd7d259ca1c62a458090e04805eda637459b2922..872ee732816076845e83be32de2c9f1be9e795b9 100644 --- a/test/fuzztest/fuzztest_others/updateextresourcesdb_fuzzer/updateextresourcesdb_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/updateextresourcesdb_fuzzer/updateextresourcesdb_fuzzer.cpp @@ -29,7 +29,7 @@ namespace { ExtendResourceManagerHostImpl impl; std::vector oldFilePaths; oldFilePaths.push_back(FILE_PATH); - std::vector newFilePaths; + std::vector newFilePaths = {std::string(reinterpret_cast(data), size)}; newFilePaths.push_back(DIR_PATH_TWO); auto ret = impl.CopyToTempDir(BUNDLE_NAME, oldFilePaths, newFilePaths); if (ret != ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR) { diff --git a/test/fuzztest/fuzztest_others/verifymanagerhostimplcheckfileparam_fuzzer/verifymanagerhostimplcheckfileparam_fuzzer.cpp b/test/fuzztest/fuzztest_others/verifymanagerhostimplcheckfileparam_fuzzer/verifymanagerhostimplcheckfileparam_fuzzer.cpp index c1e5e68c5a40527b25f54415b3eb8fc7c4cc24f0..ecb05570a5413344c6c4e97a1b229b98396059fd 100644 --- a/test/fuzztest/fuzztest_others/verifymanagerhostimplcheckfileparam_fuzzer/verifymanagerhostimplcheckfileparam_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/verifymanagerhostimplcheckfileparam_fuzzer/verifymanagerhostimplcheckfileparam_fuzzer.cpp @@ -29,7 +29,7 @@ constexpr size_t U32_AT_SIZE = 4; bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { VerifyManagerHostImpl impl; - std::vector abcPaths; + std::vector abcPaths = {std::string(data, size)}; auto ret1 = impl.CheckFileParam(abcPaths); return true; } diff --git a/test/fuzztest/fuzztest_others/verifymanagerhostimplcopyfilestotempdir_fuzzer/verifymanagerhostimplcopyfilestotempdir_fuzzer.cpp b/test/fuzztest/fuzztest_others/verifymanagerhostimplcopyfilestotempdir_fuzzer/verifymanagerhostimplcopyfilestotempdir_fuzzer.cpp index baf0a4460a37253155982835fb488a81cfa40743..2e9f57e83c8cb999df6546d16f54651b6f27d2ab 100644 --- a/test/fuzztest/fuzztest_others/verifymanagerhostimplcopyfilestotempdir_fuzzer/verifymanagerhostimplcopyfilestotempdir_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/verifymanagerhostimplcopyfilestotempdir_fuzzer/verifymanagerhostimplcopyfilestotempdir_fuzzer.cpp @@ -38,7 +38,7 @@ namespace OHOS { VerifyManagerHostImpl impl; std::string bundleName(data, size); int32_t userId = static_cast(GetU32Data(data)); - std::vector abcPaths = { std::string(data, size) }; + std::vector abcPaths = {std::string(data, size)}; auto ret1 = impl.CopyFilesToTempDir(bundleName, userId, abcPaths); return true; } diff --git a/test/fuzztest/fuzztest_others/verifymanagerhostimplgetrealpath_fuzzer/verifymanagerhostimplgetrealpath_fuzzer.cpp b/test/fuzztest/fuzztest_others/verifymanagerhostimplgetrealpath_fuzzer/verifymanagerhostimplgetrealpath_fuzzer.cpp index 8dcaa114617bbe09b36b46cf25cfbb094e021cc1..d645b162f150d4c0429e6b9e4825f76ace8ef519 100644 --- a/test/fuzztest/fuzztest_others/verifymanagerhostimplgetrealpath_fuzzer/verifymanagerhostimplgetrealpath_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/verifymanagerhostimplgetrealpath_fuzzer/verifymanagerhostimplgetrealpath_fuzzer.cpp @@ -31,7 +31,7 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) VerifyManagerHostImpl impl; std::string bundleName; int32_t userId = 100; - std::string relativePath; + std::string relativePath = std::string(data, size); std::vector abcPaths; impl.GetRealPath(bundleName, userId, relativePath); impl.CopyFilesToTempDir(bundleName, userId, abcPaths); diff --git a/test/fuzztest/fuzztest_others/verifymanagerhostimplinnerverify_fuzzer/verifymanagerhostimplinnerverify_fuzzer.cpp b/test/fuzztest/fuzztest_others/verifymanagerhostimplinnerverify_fuzzer/verifymanagerhostimplinnerverify_fuzzer.cpp index 519042b31795d07500d08c644b0ad01fd90c14a2..f6c8e4e2d6b28404d3590880cbde45f1c9af03e5 100644 --- a/test/fuzztest/fuzztest_others/verifymanagerhostimplinnerverify_fuzzer/verifymanagerhostimplinnerverify_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/verifymanagerhostimplinnerverify_fuzzer/verifymanagerhostimplinnerverify_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { { VerifyManagerHostImpl impl; std::string bundleName(data, size); - std::vector abcPaths = { std::string(data, size) }; + std::vector abcPaths = {std::string(data, size)}; auto ret1 = impl.InnerVerify(bundleName, abcPaths); return true; } diff --git a/test/fuzztest/fuzztest_others/verifymanagerhostimplmoveabc_fuzzer/verifymanagerhostimplmoveabc_fuzzer.cpp b/test/fuzztest/fuzztest_others/verifymanagerhostimplmoveabc_fuzzer/verifymanagerhostimplmoveabc_fuzzer.cpp index 8ce945476d48337a5354135ec36145fe4e4e4fe1..1c1206bb957b3f4a86c5f80c6a4383086fd48bb9 100644 --- a/test/fuzztest/fuzztest_others/verifymanagerhostimplmoveabc_fuzzer/verifymanagerhostimplmoveabc_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/verifymanagerhostimplmoveabc_fuzzer/verifymanagerhostimplmoveabc_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { { VerifyManagerHostImpl impl; const std::string bundleName{data, size}; - std::vector abcPaths = { std::string(data, size) }; + std::vector abcPaths = {std::string(data, size)}; auto ret1 = impl.MoveAbc(bundleName, abcPaths); return true; } diff --git a/test/fuzztest/fuzztest_others/verifymanagerhostimplremovetempfiles_fuzzer/verifymanagerhostimplremovetempfiles_fuzzer.cpp b/test/fuzztest/fuzztest_others/verifymanagerhostimplremovetempfiles_fuzzer/verifymanagerhostimplremovetempfiles_fuzzer.cpp index e57a5d11548de92d33a03aa99e4faad5dcdf56ac..c0538ff985c7b4130adffbd1c01a16a24202efed 100644 --- a/test/fuzztest/fuzztest_others/verifymanagerhostimplremovetempfiles_fuzzer/verifymanagerhostimplremovetempfiles_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/verifymanagerhostimplremovetempfiles_fuzzer/verifymanagerhostimplremovetempfiles_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { { VerifyManagerHostImpl impl; std::string bundleName; - std::vector paths; + std::vector paths = {std::string(data, size)}; impl.RemoveTempFiles(bundleName); impl.RemoveTempFiles(paths); return true; diff --git a/test/fuzztest/fuzztest_others/verifymanagerhostimplremovetempfilespaths_fuzzer/verifymanagerhostimplremovetempfilespaths_fuzzer.cpp b/test/fuzztest/fuzztest_others/verifymanagerhostimplremovetempfilespaths_fuzzer/verifymanagerhostimplremovetempfilespaths_fuzzer.cpp index 51084c2d22048c06228e9256538140dcc2845c4e..2cb4dc98343d62040b954fd50efd1733d577254f 100644 --- a/test/fuzztest/fuzztest_others/verifymanagerhostimplremovetempfilespaths_fuzzer/verifymanagerhostimplremovetempfilespaths_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/verifymanagerhostimplremovetempfilespaths_fuzzer/verifymanagerhostimplremovetempfilespaths_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { VerifyManagerHostImpl impl; - std::vector paths; + std::vector paths = {std::string(data, size)}; impl.RemoveTempFiles(paths); return true; } diff --git a/test/fuzztest/fuzztest_others/verifymanagerhostimplrollback_fuzzer/verifymanagerhostimplrollback_fuzzer.cpp b/test/fuzztest/fuzztest_others/verifymanagerhostimplrollback_fuzzer/verifymanagerhostimplrollback_fuzzer.cpp index b28cdc7c86e78a89f4f3d23f3f3285ca085a5c34..97a3fc539baca7bae278845817683a50b74cc536 100644 --- a/test/fuzztest/fuzztest_others/verifymanagerhostimplrollback_fuzzer/verifymanagerhostimplrollback_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/verifymanagerhostimplrollback_fuzzer/verifymanagerhostimplrollback_fuzzer.cpp @@ -29,7 +29,7 @@ namespace OHOS { VerifyManagerHostImpl impl; std::vector Paths; std::string rootDir; - std::vector names; + std::vector names = {std::string(data, size)}; impl.Rollback(Paths); impl.Rollback(rootDir, names); return true; diff --git a/test/fuzztest/fuzztest_others/verifymanagerhostimplverify_fuzzer/verifymanagerhostimplverify_fuzzer.cpp b/test/fuzztest/fuzztest_others/verifymanagerhostimplverify_fuzzer/verifymanagerhostimplverify_fuzzer.cpp index 9b2ae38c512fb0689cb4e37637c91109d1d77654..457c7ba44e4d42a47158733e5d3eb19b33e0b41b 100644 --- a/test/fuzztest/fuzztest_others/verifymanagerhostimplverify_fuzzer/verifymanagerhostimplverify_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/verifymanagerhostimplverify_fuzzer/verifymanagerhostimplverify_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { VerifyManagerHostImpl impl; - std::vector abcPaths = { std::string(data, size) }; + std::vector abcPaths = {std::string(data, size)}; auto ret1 = impl.Verify(abcPaths); return true; } diff --git a/test/fuzztest/fuzztest_others/verifymanagerhostimplverifyabc_fuzzer/verifymanagerhostimplverifyabc_fuzzer.cpp b/test/fuzztest/fuzztest_others/verifymanagerhostimplverifyabc_fuzzer/verifymanagerhostimplverifyabc_fuzzer.cpp index 53962f79b1cea3309d93d851e776837a0a2cc194..7e5bf9b396b2a6309fc93e0695f27f4a9bc838b4 100644 --- a/test/fuzztest/fuzztest_others/verifymanagerhostimplverifyabc_fuzzer/verifymanagerhostimplverifyabc_fuzzer.cpp +++ b/test/fuzztest/fuzztest_others/verifymanagerhostimplverifyabc_fuzzer/verifymanagerhostimplverifyabc_fuzzer.cpp @@ -28,7 +28,7 @@ namespace OHOS { { VerifyManagerHostImpl impl; std::vector abcPaths; - std::string rootDir; + std::string rootDir = std::string(data, size); std::vector names; auto ret1 = impl.VerifyAbc(abcPaths); auto ret2 = impl.VerifyAbc(rootDir, names);