From 22500f7800135ec80027678a21dbcb2bca9bcc9b Mon Sep 17 00:00:00 2001 From: chengjinsong2 Date: Thu, 20 Oct 2022 03:15:53 -0700 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85fuzztest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chengjinsong2 Change-Id: I8f88d67e67ccbe5db506eb3578c71f9bbcc384d1 --- .../innerkits/control_fd/control_fd_service.c | 1 + .../AclGetDevUdid_fuzzer.cpp | 39 + .../AclGetDevUdid_fuzzer.h | 20 + .../corpus/init | 0 .../project.xml | 2 +- .../AclGetSerial_fuzzer.cpp | 37 + .../AclGetSerial_fuzzer/AclGetSerial_fuzzer.h | 20 + .../corpus/init | 0 .../project.xml | 2 +- test/fuzztest/BUILD.gn | 2545 ++++++++++++++++- .../BuildControlMessage_fuzzer.cpp | 37 + .../BuildControlMessage_fuzzer.h | 20 + .../corpus/init | 0 .../project.xml | 2 +- .../CmdClientInit_fuzzer.cpp | 35 + .../CmdClientInit_fuzzer.h | 20 + .../corpus/init | 0 .../project.xml | 2 +- .../CmdServiceInit_fuzzer.cpp | 42 + .../CmdServiceInit_fuzzer.h | 20 + .../corpus/init | 0 .../CmdServiceInit_fuzzer/project.xml | 25 + .../CmdServiceProcessDelClient_fuzzer.cpp | 34 + .../CmdServiceProcessDelClient_fuzzer.h | 20 + .../corpus/init | 0 .../project.xml | 25 + .../DoFormat_fuzzer/DoFormat_fuzzer.cpp | 39 + .../DoFormat_fuzzer/DoFormat_fuzzer.h | 20 + .../corpus/init | 0 test/fuzztest/DoFormat_fuzzer/project.xml | 25 + .../FindFstabItemForMountPoint_fuzzer.cpp | 55 + .../FindFstabItemForMountPoint_fuzzer.h | 20 + .../corpus/init | 0 .../project.xml | 25 + .../FindFstabItemForPath_fuzzer.cpp | 55 + .../FindFstabItemForPath_fuzzer.h | 20 + .../corpus/init | 0 .../FindFstabItemForPath_fuzzer/project.xml | 25 + .../FindParameter_fuzzer.cpp} | 16 +- .../FindParameter_fuzzer.h | 20 + .../corpus/init | 0 .../fuzztest/FindParameter_fuzzer/project.xml | 25 + .../GetAbiList_fuzzer/GetAbiList_fuzzer.cpp | 37 + .../GetAbiList_fuzzer/GetAbiList_fuzzer.h | 20 + test/fuzztest/GetAbiList_fuzzer/corpus/init | 16 + test/fuzztest/GetAbiList_fuzzer/project.xml | 25 + .../GetBlockDeviceByMountPoint_fuzzer.cpp | 54 + .../GetBlockDeviceByMountPoint_fuzzer.h | 20 + .../corpus/init | 16 + .../project.xml | 25 + .../GetBlockDeviceByName_fuzzer.cpp | 57 + .../GetBlockDeviceByName_fuzzer.h | 20 + .../GetBlockDeviceByName_fuzzer/corpus/init | 16 + .../GetBlockDeviceByName_fuzzer/project.xml | 25 + .../GetBlockDevicePath_fuzzer.cpp | 39 + .../GetBlockDevicePath_fuzzer.h | 20 + .../GetBlockDevicePath_fuzzer/corpus/init | 16 + .../GetBlockDevicePath_fuzzer/project.xml | 25 + .../GetBoolParameterCpp_fuzzer.cpp | 38 + .../GetBoolParameterCpp_fuzzer.h | 20 + .../GetBoolParameterCpp_fuzzer/corpus/init | 16 + .../GetBoolParameterCpp_fuzzer/project.xml | 25 + .../GetBootSlots_fuzzer.cpp | 34 + .../GetBootSlots_fuzzer/GetBootSlots_fuzzer.h | 20 + test/fuzztest/GetBootSlots_fuzzer/corpus/init | 16 + test/fuzztest/GetBootSlots_fuzzer/project.xml | 25 + .../GetBootloaderVersion_fuzzer.cpp | 37 + .../GetBootloaderVersion_fuzzer.h | 20 + .../GetBootloaderVersion_fuzzer/corpus/init | 16 + .../GetBootloaderVersion_fuzzer/project.xml | 25 + .../GetBrand_fuzzer/GetBrand_fuzzer.cpp | 37 + .../GetBrand_fuzzer/GetBrand_fuzzer.h | 20 + test/fuzztest/GetBrand_fuzzer/corpus/init | 16 + test/fuzztest/GetBrand_fuzzer/project.xml | 25 + .../GetBuildHost_fuzzer.cpp | 37 + .../GetBuildHost_fuzzer/GetBuildHost_fuzzer.h | 20 + test/fuzztest/GetBuildHost_fuzzer/corpus/init | 16 + test/fuzztest/GetBuildHost_fuzzer/project.xml | 25 + .../GetBuildRootHash_fuzzer.cpp | 37 + .../GetBuildRootHash_fuzzer.h | 20 + .../GetBuildRootHash_fuzzer/corpus/init | 16 + .../GetBuildRootHash_fuzzer/project.xml | 25 + .../GetBuildTime_fuzzer.cpp | 37 + .../GetBuildTime_fuzzer/GetBuildTime_fuzzer.h | 20 + test/fuzztest/GetBuildTime_fuzzer/corpus/init | 16 + test/fuzztest/GetBuildTime_fuzzer/project.xml | 25 + .../GetBuildType_fuzzer.cpp | 37 + .../GetBuildType_fuzzer/GetBuildType_fuzzer.h | 20 + test/fuzztest/GetBuildType_fuzzer/corpus/init | 16 + test/fuzztest/GetBuildType_fuzzer/project.xml | 25 + .../GetBuildUser_fuzzer.cpp | 37 + .../GetBuildUser_fuzzer/GetBuildUser_fuzzer.h | 20 + test/fuzztest/GetBuildUser_fuzzer/corpus/init | 16 + test/fuzztest/GetBuildUser_fuzzer/project.xml | 25 + .../GetBuildVersion_fuzzer.cpp | 37 + .../GetBuildVersion_fuzzer.h | 20 + .../GetBuildVersion_fuzzer/corpus/init | 16 + .../GetBuildVersion_fuzzer/project.xml | 25 + .../GetCurrentSlot_fuzzer.cpp | 37 + .../GetCurrentSlot_fuzzer.h | 20 + .../GetCurrentSlot_fuzzer/corpus/init | 16 + .../GetCurrentSlot_fuzzer/project.xml | 25 + .../GetDevUdid_fuzzer/GetDevUdid_fuzzer.cpp | 39 + .../GetDevUdid_fuzzer/GetDevUdid_fuzzer.h | 20 + test/fuzztest/GetDevUdid_fuzzer/corpus/init | 16 + test/fuzztest/GetDevUdid_fuzzer/project.xml | 25 + .../GetDeviceTypeC_fuzzer.cpp | 37 + .../GetDeviceTypeC_fuzzer.h | 20 + .../GetDeviceTypeC_fuzzer/corpus/init | 16 + .../GetDeviceTypeC_fuzzer/project.xml | 25 + .../GetDeviceTypeCpp_fuzzer.cpp | 34 + .../GetDeviceTypeCpp_fuzzer.h | 20 + .../GetDeviceTypeCpp_fuzzer/corpus/init | 16 + .../GetDeviceTypeCpp_fuzzer/project.xml | 25 + .../GetDisplayVersion_fuzzer.cpp | 37 + .../GetDisplayVersion_fuzzer.h | 20 + .../GetDisplayVersion_fuzzer/corpus/init | 16 + .../GetDisplayVersion_fuzzer/project.xml | 25 + .../GetFeatureVersion_fuzzer.cpp | 37 + .../GetFeatureVersion_fuzzer.h | 20 + .../GetFeatureVersion_fuzzer/corpus/init | 16 + .../GetFeatureVersion_fuzzer/project.xml | 25 + .../GetFirstApiVersion_fuzzer.cpp | 37 + .../GetFirstApiVersion_fuzzer.h | 20 + .../GetFirstApiVersion_fuzzer/corpus/init | 16 + .../GetFirstApiVersion_fuzzer/project.xml | 25 + .../GetHardwareModel_fuzzer.cpp | 37 + .../GetHardwareModel_fuzzer.h | 20 + .../GetHardwareModel_fuzzer/corpus/init | 16 + .../GetHardwareModel_fuzzer/project.xml | 25 + .../GetHardwareProfile_fuzzer.cpp | 37 + .../GetHardwareProfile_fuzzer.h | 20 + .../GetHardwareProfile_fuzzer/corpus/init | 16 + .../GetHardwareProfile_fuzzer/project.xml | 25 + .../GetIncrementalVersion_fuzzer.cpp | 37 + .../GetIncrementalVersion_fuzzer.h | 20 + .../GetIncrementalVersion_fuzzer/corpus/init | 16 + .../GetIncrementalVersion_fuzzer/project.xml | 25 + .../GetIntParameterC_fuzzer.cpp | 36 + .../GetIntParameterC_fuzzer.h | 20 + .../GetIntParameterC_fuzzer/corpus/init | 16 + .../GetIntParameterC_fuzzer/project.xml | 25 + .../GetIntParameterCpp_fuzzer.cpp | 35 + .../GetIntParameterCpp_fuzzer.h | 20 + .../GetIntParameterCpp_fuzzer/corpus/init | 16 + .../GetIntParameterCpp_fuzzer/project.xml | 25 + .../GetMajorVersion_fuzzer.cpp | 37 + .../GetMajorVersion_fuzzer.h | 20 + .../GetMajorVersion_fuzzer/corpus/init | 16 + .../GetMajorVersion_fuzzer/project.xml | 25 + .../GetManufacture_fuzzer.cpp | 37 + .../GetManufacture_fuzzer.h | 20 + .../GetManufacture_fuzzer/corpus/init | 16 + .../GetManufacture_fuzzer/project.xml | 25 + .../GetMarketName_fuzzer.cpp | 37 + .../GetMarketName_fuzzer.h | 20 + .../fuzztest/GetMarketName_fuzzer/corpus/init | 16 + .../fuzztest/GetMarketName_fuzzer/project.xml | 25 + .../GetMountStatusForMountPoint_fuzzer.cpp | 39 + .../GetMountStatusForMountPoint_fuzzer.h | 20 + .../corpus/init | 16 + .../project.xml | 25 + .../GetOSFullName_fuzzer.cpp | 37 + .../GetOSFullName_fuzzer.h | 20 + .../fuzztest/GetOSFullName_fuzzer/corpus/init | 16 + .../fuzztest/GetOSFullName_fuzzer/project.xml | 25 + .../GetOsReleaseType_fuzzer.cpp | 37 + .../GetOsReleaseType_fuzzer.h | 20 + .../GetOsReleaseType_fuzzer/corpus/init | 16 + .../GetOsReleaseType_fuzzer/project.xml | 25 + .../GetParameterC_fuzzer.cpp} | 17 +- .../GetParameterC_fuzzer.h | 20 + .../fuzztest/GetParameterC_fuzzer/corpus/init | 16 + .../fuzztest/GetParameterC_fuzzer/project.xml | 25 + .../GetParameterCommitId_fuzzer.cpp} | 14 +- .../GetParameterCommitId_fuzzer.h | 20 + .../GetParameterCommitId_fuzzer/corpus/init | 16 + .../GetParameterCommitId_fuzzer/project.xml | 25 + .../GetParameterCpp_fuzzer.cpp | 39 + .../GetParameterCpp_fuzzer.h | 20 + .../GetParameterCpp_fuzzer/corpus/init | 16 + .../GetParameterCpp_fuzzer/project.xml | 25 + .../GetParameterName_fuzzer.cpp} | 13 +- .../GetParameterName_fuzzer.h | 20 + .../GetParameterName_fuzzer/corpus/init | 16 + .../GetParameterName_fuzzer/project.xml | 25 + .../GetParameterValue_fuzzer.cpp} | 13 +- .../GetParameterValue_fuzzer.h | 20 + .../GetParameterValue_fuzzer/corpus/init | 16 + .../GetParameterValue_fuzzer/project.xml | 25 + .../GetProductModel_fuzzer.cpp | 37 + .../GetProductModel_fuzzer.h | 20 + .../GetProductModel_fuzzer/corpus/init | 16 + .../GetProductModel_fuzzer/project.xml | 25 + .../GetProductSeries_fuzzer.cpp | 37 + .../GetProductSeries_fuzzer.h | 20 + .../GetProductSeries_fuzzer/corpus/init | 16 + .../GetProductSeries_fuzzer/project.xml | 25 + .../GetSdkApiVersion_fuzzer.cpp | 37 + .../GetSdkApiVersion_fuzzer.h | 20 + .../GetSdkApiVersion_fuzzer/corpus/init | 16 + .../GetSdkApiVersion_fuzzer/project.xml | 25 + .../GetSecurityPatchTag_fuzzer.cpp | 37 + .../GetSecurityPatchTag_fuzzer.h | 20 + .../GetSecurityPatchTag_fuzzer/corpus/init | 16 + .../GetSecurityPatchTag_fuzzer/project.xml | 25 + .../GetSeniorVersion_fuzzer.cpp | 37 + .../GetSeniorVersion_fuzzer.h | 20 + .../GetSeniorVersion_fuzzer/corpus/init | 16 + .../GetSeniorVersion_fuzzer/project.xml | 25 + .../GetSerial_fuzzer/GetSerial_fuzzer.cpp | 37 + .../GetSerial_fuzzer/GetSerial_fuzzer.h | 20 + test/fuzztest/GetSerial_fuzzer/corpus/init | 16 + test/fuzztest/GetSerial_fuzzer/project.xml | 25 + .../GetSoftwareModel_fuzzer.cpp | 37 + .../GetSoftwareModel_fuzzer.h | 20 + .../GetSoftwareModel_fuzzer/corpus/init | 16 + .../GetSoftwareModel_fuzzer/project.xml | 25 + .../GetStringParameter_fuzzer.cpp | 39 + .../GetStringParameter_fuzzer.h} | 4 +- .../GetStringParameter_fuzzer/corpus/init | 16 + .../GetStringParameter_fuzzer/project.xml | 25 + .../GetSystemCommitId_fuzzer.cpp | 37 + .../GetSystemCommitId_fuzzer.h | 20 + .../GetSystemCommitId_fuzzer/corpus/init | 16 + .../GetSystemCommitId_fuzzer/project.xml | 25 + .../GetUintParameterC_fuzzer.cpp | 35 + .../GetUintParameterC_fuzzer.h | 20 + .../GetUintParameterC_fuzzer/corpus/init | 16 + .../GetUintParameterC_fuzzer/project.xml | 25 + .../GetVersionId_fuzzer.cpp | 37 + .../GetVersionId_fuzzer/GetVersionId_fuzzer.h | 20 + test/fuzztest/GetVersionId_fuzzer/corpus/init | 16 + test/fuzztest/GetVersionId_fuzzer/project.xml | 25 + .../HasSystemCapability_fuzzer.cpp} | 14 +- .../HasSystemCapability_fuzzer.h | 20 + .../HasSystemCapability_fuzzer/corpus/init | 16 + .../HasSystemCapability_fuzzer/project.xml | 25 + .../HookMgrAddEx_fuzzer.cpp | 40 + .../HookMgrAddEx_fuzzer/HookMgrAddEx_fuzzer.h | 20 + test/fuzztest/HookMgrAddEx_fuzzer/corpus/init | 16 + test/fuzztest/HookMgrAddEx_fuzzer/project.xml | 25 + .../HookMgrAdd_fuzzer/HookMgrAdd_fuzzer.cpp | 46 + .../HookMgrAdd_fuzzer/HookMgrAdd_fuzzer.h | 20 + test/fuzztest/HookMgrAdd_fuzzer/corpus/init | 16 + test/fuzztest/HookMgrAdd_fuzzer/project.xml | 25 + .../HookMgrCreate_fuzzer.cpp | 38 + .../HookMgrCreate_fuzzer.h | 20 + .../fuzztest/HookMgrCreate_fuzzer/corpus/init | 16 + .../fuzztest/HookMgrCreate_fuzzer/project.xml | 25 + .../HookMgrDel_fuzzer/HookMgrDel_fuzzer.cpp | 42 + .../HookMgrDel_fuzzer/HookMgrDel_fuzzer.h | 20 + test/fuzztest/HookMgrDel_fuzzer/corpus/init | 16 + test/fuzztest/HookMgrDel_fuzzer/project.xml | 25 + .../HookMgrDestroy_fuzzer.cpp | 36 + .../HookMgrDestroy_fuzzer.h | 20 + .../HookMgrDestroy_fuzzer/corpus/init | 16 + .../HookMgrDestroy_fuzzer/project.xml | 25 + .../HookMgrExecute_fuzzer.cpp | 40 + .../HookMgrExecute_fuzzer.h | 20 + .../HookMgrExecute_fuzzer/corpus/init | 16 + .../HookMgrExecute_fuzzer/project.xml | 25 + .../HookMgrGetHooksCnt_fuzzer.cpp | 39 + .../HookMgrGetHooksCnt_fuzzer.h | 20 + .../HookMgrGetHooksCnt_fuzzer/corpus/init | 16 + .../HookMgrGetHooksCnt_fuzzer/project.xml | 25 + .../HookMgrGetStagesCnt_fuzzer.cpp | 39 + .../HookMgrGetStagesCnt_fuzzer.h | 20 + .../HookMgrGetStagesCnt_fuzzer/corpus/init | 16 + .../HookMgrGetStagesCnt_fuzzer/project.xml | 25 + .../HookMgrTraversal_fuzzer.cpp | 41 + .../HookMgrTraversal_fuzzer.h | 20 + .../HookMgrTraversal_fuzzer/corpus/init | 16 + .../HookMgrTraversal_fuzzer/project.xml | 25 + .../IsSupportedFilesystem_fuzzer.cpp | 35 + .../IsSupportedFilesystem_fuzzer.h | 20 + .../IsSupportedFilesystem_fuzzer/corpus/init | 16 + .../IsSupportedFilesystem_fuzzer/project.xml | 25 + .../LoadFscryptPolicy_fuzzer.cpp | 39 + .../LoadFscryptPolicy_fuzzer.h | 20 + .../LoadFscryptPolicy_fuzzer/corpus/init | 16 + .../LoadFscryptPolicy_fuzzer/project.xml | 25 + .../LoadFstabFromCommandLine_fuzzer.cpp | 37 + .../LoadFstabFromCommandLine_fuzzer.h | 20 + .../corpus/init | 16 + .../project.xml | 25 + .../ModuleMgrCreate_fuzzer.cpp | 38 + .../ModuleMgrCreate_fuzzer.h | 20 + .../ModuleMgrCreate_fuzzer/corpus/init | 16 + .../ModuleMgrCreate_fuzzer/project.xml | 25 + .../ModuleMgrDestroy_fuzzer.cpp | 35 + .../ModuleMgrDestroy_fuzzer.h | 20 + .../ModuleMgrDestroy_fuzzer/corpus/init | 16 + .../ModuleMgrDestroy_fuzzer/project.xml | 25 + .../ModuleMgrGetCnt_fuzzer.cpp | 40 + .../ModuleMgrGetCnt_fuzzer.h | 20 + .../ModuleMgrGetCnt_fuzzer/corpus/init | 16 + .../ModuleMgrGetCnt_fuzzer/project.xml | 25 + .../ModuleMgrInstall_fuzzer.cpp | 39 + .../ModuleMgrInstall_fuzzer.h | 20 + .../ModuleMgrInstall_fuzzer/corpus/init | 16 + .../ModuleMgrInstall_fuzzer/project.xml | 25 + .../ModuleMgrScan_fuzzer.cpp | 39 + .../ModuleMgrScan_fuzzer.h | 20 + .../fuzztest/ModuleMgrScan_fuzzer/corpus/init | 16 + .../fuzztest/ModuleMgrScan_fuzzer/project.xml | 25 + .../ModuleMgrTraversal_fuzzer.cpp | 41 + .../ModuleMgrTraversal_fuzzer.h | 20 + .../ModuleMgrTraversal_fuzzer/corpus/init | 16 + .../ModuleMgrTraversal_fuzzer/project.xml | 25 + .../ModuleMgrUninstall_fuzzer.cpp | 36 + .../ModuleMgrUninstall_fuzzer.h | 20 + .../ModuleMgrUninstall_fuzzer/corpus/init | 16 + .../ModuleMgrUninstall_fuzzer/project.xml | 25 + .../MountAllWithFstabFile_fuzzer.cpp} | 7 +- .../MountAllWithFstabFile_fuzzer.h} | 4 +- .../MountAllWithFstabFile_fuzzer/corpus/init | 16 + .../MountAllWithFstabFile_fuzzer/project.xml | 25 + .../MountAllWithFstab_fuzzer.cpp | 50 + .../MountAllWithFstab_fuzzer.h | 20 + .../MountAllWithFstab_fuzzer/corpus/init | 16 + .../MountAllWithFstab_fuzzer/project.xml | 25 + .../MountOneItem_fuzzer.cpp | 55 + .../MountOneItem_fuzzer/MountOneItem_fuzzer.h | 20 + test/fuzztest/MountOneItem_fuzzer/corpus/init | 16 + test/fuzztest/MountOneItem_fuzzer/project.xml | 25 + .../ParseFstabPerLine_fuzzer.cpp | 55 + .../ParseFstabPerLine_fuzzer.h | 20 + .../ParseFstabPerLine_fuzzer/corpus/init | 16 + .../ParseFstabPerLine_fuzzer/project.xml | 25 + .../ReadFstabFromFile_fuzzer.cpp | 50 + .../ReadFstabFromFile_fuzzer.h | 20 + .../ReadFstabFromFile_fuzzer/corpus/init | 16 + .../ReadFstabFromFile_fuzzer/project.xml | 25 + .../ReceiveFds_fuzzer/ReceiveFds_fuzzer.cpp | 38 + .../ReceiveFds_fuzzer/ReceiveFds_fuzzer.h | 20 + test/fuzztest/ReceiveFds_fuzzer/corpus/init | 16 + test/fuzztest/ReceiveFds_fuzzer/project.xml | 25 + .../ReleaseFstab_fuzzer.cpp | 48 + .../ReleaseFstab_fuzzer/ReleaseFstab_fuzzer.h | 20 + test/fuzztest/ReleaseFstab_fuzzer/corpus/init | 16 + test/fuzztest/ReleaseFstab_fuzzer/project.xml | 25 + .../RemoveParameterWatcher_fuzzer.cpp | 48 + .../RemoveParameterWatcher_fuzzer.h | 20 + .../RemoveParameterWatcher_fuzzer/corpus/init | 16 + .../RemoveParameterWatcher_fuzzer/project.xml | 25 + .../ServiceControlWithExtra_fuzzer.cpp | 38 + .../ServiceControlWithExtra_fuzzer.h | 20 + .../corpus/init | 16 + .../project.xml | 25 + .../ServiceControl_fuzzer.cpp | 38 + .../ServiceControl_fuzzer.h | 20 + .../ServiceControl_fuzzer/corpus/init | 16 + .../ServiceControl_fuzzer/project.xml | 25 + .../ServiceGetFd_fuzzer.cpp | 39 + .../ServiceGetFd_fuzzer/ServiceGetFd_fuzzer.h | 20 + test/fuzztest/ServiceGetFd_fuzzer/corpus/init | 16 + test/fuzztest/ServiceGetFd_fuzzer/project.xml | 25 + .../ServiceSaveFdWithPoll_fuzzer.cpp | 40 + .../ServiceSaveFdWithPoll_fuzzer.h | 20 + .../ServiceSaveFdWithPoll_fuzzer/corpus/init | 16 + .../ServiceSaveFdWithPoll_fuzzer/project.xml | 25 + .../ServiceSaveFd_fuzzer.cpp | 40 + .../ServiceSaveFd_fuzzer.h | 20 + .../fuzztest/ServiceSaveFd_fuzzer/corpus/init | 16 + .../fuzztest/ServiceSaveFd_fuzzer/project.xml | 25 + .../ServiceSetReady_fuzzer.cpp | 38 + .../ServiceSetReady_fuzzer.h | 20 + .../ServiceSetReady_fuzzer/corpus/init | 16 + .../ServiceSetReady_fuzzer/project.xml | 25 + .../ServiceWaitForStatus_fuzzer.cpp | 38 + .../ServiceWaitForStatus_fuzzer.h | 20 + .../ServiceWaitForStatus_fuzzer/corpus/init | 16 + .../ServiceWaitForStatus_fuzzer/project.xml | 25 + .../ServiceWatchForStatus_fuzzer.cpp | 45 + .../ServiceWatchForStatus_fuzzer.h | 20 + .../ServiceWatchForStatus_fuzzer/corpus/init | 16 + .../ServiceWatchForStatus_fuzzer/project.xml | 25 + .../SetParameterC_fuzzer.cpp | 38 + .../SetParameterC_fuzzer.h | 20 + .../fuzztest/SetParameterC_fuzzer/corpus/init | 16 + .../fuzztest/SetParameterC_fuzzer/project.xml | 25 + .../SetParameterCpp_fuzzer.cpp | 38 + .../SetParameterCpp_fuzzer.h | 20 + .../SetParameterCpp_fuzzer/corpus/init | 16 + .../SetParameterCpp_fuzzer/project.xml | 25 + .../StartServiceByTimer_fuzzer.cpp} | 14 +- .../StartServiceByTimer_fuzzer.h | 20 + .../StartServiceByTimer_fuzzer/corpus/init | 16 + .../StartServiceByTimer_fuzzer/project.xml | 25 + .../StopServiceTimer_fuzzer.cpp | 38 + .../StopServiceTimer_fuzzer.h | 20 + .../StopServiceTimer_fuzzer/corpus/init | 16 + .../StopServiceTimer_fuzzer/project.xml | 25 + .../UmountAllWithFstabFile_fuzzer.cpp} | 7 +- .../UmountAllWithFstabFile_fuzzer.h} | 4 +- .../UmountAllWithFstabFile_fuzzer/corpus/init | 16 + .../UmountAllWithFstabFile_fuzzer/project.xml | 25 + .../WaitParameter_fuzzer.cpp | 38 + .../WaitParameter_fuzzer.h | 20 + .../fuzztest/WaitParameter_fuzzer/corpus/init | 16 + .../fuzztest/WaitParameter_fuzzer/project.xml | 25 + .../WatchParameter_fuzzer.cpp} | 19 +- .../WatchParameter_fuzzer.h | 20 + .../WatchParameter_fuzzer/corpus/init | 16 + .../WatchParameter_fuzzer/project.xml | 25 + .../doreboot_fuzzer/doreboot_fuzzer.cpp | 4 +- .../doreboot_fuzzer/doreboot_fuzzer.h | 4 +- test/fuzztest/doreboot_fuzzer/project.xml | 2 +- .../getcontrolfile_fuzzer.cpp | 6 +- .../getcontrolfile_fuzzer.h | 4 +- .../getcontrolfile_fuzzer/project.xml | 2 +- .../getcontrolsocket_fuzzer.cpp | 4 +- .../getcontrolsocket_fuzzer.h | 4 +- .../getcontrolsocket_fuzzer/project.xml | 2 +- test/fuzztest/project.xml | 2 +- .../fuzztest/readfileindir_fuzzer/project.xml | 2 +- .../readfileindir_fuzzer.cpp | 4 +- .../readfileindir_fuzzer.h | 4 +- .../servicecontrolstart_fuzzer/project.xml | 2 +- .../servicecontrolstart_fuzzer.cpp | 4 +- .../servicecontrolstart_fuzzer.h | 4 +- .../servicecontrolstop_fuzzer/project.xml | 2 +- .../servicecontrolstop_fuzzer.cpp | 4 +- .../servicecontrolstop_fuzzer.h | 4 +- .../systemdumpparameters_fuzzer/project.xml | 2 +- .../systemdumpparameters_fuzzer.cpp | 4 +- .../systemdumpparameters_fuzzer.h | 4 +- .../systemfindparameter_fuzzer.h | 20 - .../systemgetparametercommitid_fuzzer.h | 20 - .../systemgetparametername_fuzzer/project.xml | 25 - .../systemgetparametername_fuzzer.h | 20 - .../project.xml | 25 - .../systemgetparametervalue_fuzzer.h | 20 - .../systemsetparameter_fuzzer/project.xml | 25 - .../systemsetparameter_fuzzer.h | 20 - .../project.xml | 2 +- .../systemtraversalparameter_fuzzer.cpp | 6 +- .../systemtraversalparameter_fuzzer.h | 4 +- .../systemwaitparameter_fuzzer/project.xml | 25 - .../systemwaitparameter_fuzzer.h | 20 - .../systemwatchparameter_fuzzer/project.xml | 25 - .../systemwatchparameter_fuzzer.h | 20 - .../umountallfstab_fuzzer/project.xml | 25 - test/fuzztest/utils/fuzz_utils.cpp | 6 +- test/fuzztest/utils/include/fuzz_utils.h | 4 +- 446 files changed, 12033 insertions(+), 484 deletions(-) create mode 100644 test/fuzztest/AclGetDevUdid_fuzzer/AclGetDevUdid_fuzzer.cpp create mode 100644 test/fuzztest/AclGetDevUdid_fuzzer/AclGetDevUdid_fuzzer.h rename test/fuzztest/{mountallfstab_fuzzer => AclGetDevUdid_fuzzer}/corpus/init (100%) rename test/fuzztest/{systemfindparameter_fuzzer => AclGetDevUdid_fuzzer}/project.xml (94%) create mode 100644 test/fuzztest/AclGetSerial_fuzzer/AclGetSerial_fuzzer.cpp create mode 100644 test/fuzztest/AclGetSerial_fuzzer/AclGetSerial_fuzzer.h rename test/fuzztest/{systemfindparameter_fuzzer => AclGetSerial_fuzzer}/corpus/init (100%) rename test/fuzztest/{systemgetparameter_fuzzer => AclGetSerial_fuzzer}/project.xml (94%) create mode 100644 test/fuzztest/BuildControlMessage_fuzzer/BuildControlMessage_fuzzer.cpp create mode 100644 test/fuzztest/BuildControlMessage_fuzzer/BuildControlMessage_fuzzer.h rename test/fuzztest/{systemgetparameter_fuzzer => BuildControlMessage_fuzzer}/corpus/init (100%) rename test/fuzztest/{systemgetparametercommitid_fuzzer => BuildControlMessage_fuzzer}/project.xml (94%) create mode 100644 test/fuzztest/CmdClientInit_fuzzer/CmdClientInit_fuzzer.cpp create mode 100644 test/fuzztest/CmdClientInit_fuzzer/CmdClientInit_fuzzer.h rename test/fuzztest/{systemgetparametercommitid_fuzzer => CmdClientInit_fuzzer}/corpus/init (100%) rename test/fuzztest/{mountallfstab_fuzzer => CmdClientInit_fuzzer}/project.xml (94%) create mode 100644 test/fuzztest/CmdServiceInit_fuzzer/CmdServiceInit_fuzzer.cpp create mode 100644 test/fuzztest/CmdServiceInit_fuzzer/CmdServiceInit_fuzzer.h rename test/fuzztest/{systemgetparametername_fuzzer => CmdServiceInit_fuzzer}/corpus/init (100%) create mode 100644 test/fuzztest/CmdServiceInit_fuzzer/project.xml create mode 100644 test/fuzztest/CmdServiceProcessDelClient_fuzzer/CmdServiceProcessDelClient_fuzzer.cpp create mode 100644 test/fuzztest/CmdServiceProcessDelClient_fuzzer/CmdServiceProcessDelClient_fuzzer.h rename test/fuzztest/{systemgetparametervalue_fuzzer => CmdServiceProcessDelClient_fuzzer}/corpus/init (100%) create mode 100644 test/fuzztest/CmdServiceProcessDelClient_fuzzer/project.xml create mode 100644 test/fuzztest/DoFormat_fuzzer/DoFormat_fuzzer.cpp create mode 100644 test/fuzztest/DoFormat_fuzzer/DoFormat_fuzzer.h rename test/fuzztest/{systemsetparameter_fuzzer => DoFormat_fuzzer}/corpus/init (100%) create mode 100644 test/fuzztest/DoFormat_fuzzer/project.xml create mode 100644 test/fuzztest/FindFstabItemForMountPoint_fuzzer/FindFstabItemForMountPoint_fuzzer.cpp create mode 100644 test/fuzztest/FindFstabItemForMountPoint_fuzzer/FindFstabItemForMountPoint_fuzzer.h rename test/fuzztest/{systemwaitparameter_fuzzer => FindFstabItemForMountPoint_fuzzer}/corpus/init (100%) create mode 100644 test/fuzztest/FindFstabItemForMountPoint_fuzzer/project.xml create mode 100644 test/fuzztest/FindFstabItemForPath_fuzzer/FindFstabItemForPath_fuzzer.cpp create mode 100644 test/fuzztest/FindFstabItemForPath_fuzzer/FindFstabItemForPath_fuzzer.h rename test/fuzztest/{systemwatchparameter_fuzzer => FindFstabItemForPath_fuzzer}/corpus/init (100%) create mode 100644 test/fuzztest/FindFstabItemForPath_fuzzer/project.xml rename test/fuzztest/{systemfindparameter_fuzzer/systemfindparameter_fuzzer.cpp => FindParameter_fuzzer/FindParameter_fuzzer.cpp} (70%) create mode 100644 test/fuzztest/FindParameter_fuzzer/FindParameter_fuzzer.h rename test/fuzztest/{umountallfstab_fuzzer => FindParameter_fuzzer}/corpus/init (100%) create mode 100644 test/fuzztest/FindParameter_fuzzer/project.xml create mode 100644 test/fuzztest/GetAbiList_fuzzer/GetAbiList_fuzzer.cpp create mode 100644 test/fuzztest/GetAbiList_fuzzer/GetAbiList_fuzzer.h create mode 100644 test/fuzztest/GetAbiList_fuzzer/corpus/init create mode 100644 test/fuzztest/GetAbiList_fuzzer/project.xml create mode 100644 test/fuzztest/GetBlockDeviceByMountPoint_fuzzer/GetBlockDeviceByMountPoint_fuzzer.cpp create mode 100644 test/fuzztest/GetBlockDeviceByMountPoint_fuzzer/GetBlockDeviceByMountPoint_fuzzer.h create mode 100644 test/fuzztest/GetBlockDeviceByMountPoint_fuzzer/corpus/init create mode 100644 test/fuzztest/GetBlockDeviceByMountPoint_fuzzer/project.xml create mode 100644 test/fuzztest/GetBlockDeviceByName_fuzzer/GetBlockDeviceByName_fuzzer.cpp create mode 100644 test/fuzztest/GetBlockDeviceByName_fuzzer/GetBlockDeviceByName_fuzzer.h create mode 100644 test/fuzztest/GetBlockDeviceByName_fuzzer/corpus/init create mode 100644 test/fuzztest/GetBlockDeviceByName_fuzzer/project.xml create mode 100644 test/fuzztest/GetBlockDevicePath_fuzzer/GetBlockDevicePath_fuzzer.cpp create mode 100644 test/fuzztest/GetBlockDevicePath_fuzzer/GetBlockDevicePath_fuzzer.h create mode 100644 test/fuzztest/GetBlockDevicePath_fuzzer/corpus/init create mode 100644 test/fuzztest/GetBlockDevicePath_fuzzer/project.xml create mode 100644 test/fuzztest/GetBoolParameterCpp_fuzzer/GetBoolParameterCpp_fuzzer.cpp create mode 100644 test/fuzztest/GetBoolParameterCpp_fuzzer/GetBoolParameterCpp_fuzzer.h create mode 100644 test/fuzztest/GetBoolParameterCpp_fuzzer/corpus/init create mode 100644 test/fuzztest/GetBoolParameterCpp_fuzzer/project.xml create mode 100644 test/fuzztest/GetBootSlots_fuzzer/GetBootSlots_fuzzer.cpp create mode 100644 test/fuzztest/GetBootSlots_fuzzer/GetBootSlots_fuzzer.h create mode 100644 test/fuzztest/GetBootSlots_fuzzer/corpus/init create mode 100644 test/fuzztest/GetBootSlots_fuzzer/project.xml create mode 100644 test/fuzztest/GetBootloaderVersion_fuzzer/GetBootloaderVersion_fuzzer.cpp create mode 100644 test/fuzztest/GetBootloaderVersion_fuzzer/GetBootloaderVersion_fuzzer.h create mode 100644 test/fuzztest/GetBootloaderVersion_fuzzer/corpus/init create mode 100644 test/fuzztest/GetBootloaderVersion_fuzzer/project.xml create mode 100644 test/fuzztest/GetBrand_fuzzer/GetBrand_fuzzer.cpp create mode 100644 test/fuzztest/GetBrand_fuzzer/GetBrand_fuzzer.h create mode 100644 test/fuzztest/GetBrand_fuzzer/corpus/init create mode 100644 test/fuzztest/GetBrand_fuzzer/project.xml create mode 100644 test/fuzztest/GetBuildHost_fuzzer/GetBuildHost_fuzzer.cpp create mode 100644 test/fuzztest/GetBuildHost_fuzzer/GetBuildHost_fuzzer.h create mode 100644 test/fuzztest/GetBuildHost_fuzzer/corpus/init create mode 100644 test/fuzztest/GetBuildHost_fuzzer/project.xml create mode 100644 test/fuzztest/GetBuildRootHash_fuzzer/GetBuildRootHash_fuzzer.cpp create mode 100644 test/fuzztest/GetBuildRootHash_fuzzer/GetBuildRootHash_fuzzer.h create mode 100644 test/fuzztest/GetBuildRootHash_fuzzer/corpus/init create mode 100644 test/fuzztest/GetBuildRootHash_fuzzer/project.xml create mode 100644 test/fuzztest/GetBuildTime_fuzzer/GetBuildTime_fuzzer.cpp create mode 100644 test/fuzztest/GetBuildTime_fuzzer/GetBuildTime_fuzzer.h create mode 100644 test/fuzztest/GetBuildTime_fuzzer/corpus/init create mode 100644 test/fuzztest/GetBuildTime_fuzzer/project.xml create mode 100644 test/fuzztest/GetBuildType_fuzzer/GetBuildType_fuzzer.cpp create mode 100644 test/fuzztest/GetBuildType_fuzzer/GetBuildType_fuzzer.h create mode 100644 test/fuzztest/GetBuildType_fuzzer/corpus/init create mode 100644 test/fuzztest/GetBuildType_fuzzer/project.xml create mode 100644 test/fuzztest/GetBuildUser_fuzzer/GetBuildUser_fuzzer.cpp create mode 100644 test/fuzztest/GetBuildUser_fuzzer/GetBuildUser_fuzzer.h create mode 100644 test/fuzztest/GetBuildUser_fuzzer/corpus/init create mode 100644 test/fuzztest/GetBuildUser_fuzzer/project.xml create mode 100644 test/fuzztest/GetBuildVersion_fuzzer/GetBuildVersion_fuzzer.cpp create mode 100644 test/fuzztest/GetBuildVersion_fuzzer/GetBuildVersion_fuzzer.h create mode 100644 test/fuzztest/GetBuildVersion_fuzzer/corpus/init create mode 100644 test/fuzztest/GetBuildVersion_fuzzer/project.xml create mode 100644 test/fuzztest/GetCurrentSlot_fuzzer/GetCurrentSlot_fuzzer.cpp create mode 100644 test/fuzztest/GetCurrentSlot_fuzzer/GetCurrentSlot_fuzzer.h create mode 100644 test/fuzztest/GetCurrentSlot_fuzzer/corpus/init create mode 100644 test/fuzztest/GetCurrentSlot_fuzzer/project.xml create mode 100644 test/fuzztest/GetDevUdid_fuzzer/GetDevUdid_fuzzer.cpp create mode 100644 test/fuzztest/GetDevUdid_fuzzer/GetDevUdid_fuzzer.h create mode 100644 test/fuzztest/GetDevUdid_fuzzer/corpus/init create mode 100644 test/fuzztest/GetDevUdid_fuzzer/project.xml create mode 100644 test/fuzztest/GetDeviceTypeC_fuzzer/GetDeviceTypeC_fuzzer.cpp create mode 100644 test/fuzztest/GetDeviceTypeC_fuzzer/GetDeviceTypeC_fuzzer.h create mode 100644 test/fuzztest/GetDeviceTypeC_fuzzer/corpus/init create mode 100644 test/fuzztest/GetDeviceTypeC_fuzzer/project.xml create mode 100644 test/fuzztest/GetDeviceTypeCpp_fuzzer/GetDeviceTypeCpp_fuzzer.cpp create mode 100644 test/fuzztest/GetDeviceTypeCpp_fuzzer/GetDeviceTypeCpp_fuzzer.h create mode 100644 test/fuzztest/GetDeviceTypeCpp_fuzzer/corpus/init create mode 100644 test/fuzztest/GetDeviceTypeCpp_fuzzer/project.xml create mode 100644 test/fuzztest/GetDisplayVersion_fuzzer/GetDisplayVersion_fuzzer.cpp create mode 100644 test/fuzztest/GetDisplayVersion_fuzzer/GetDisplayVersion_fuzzer.h create mode 100644 test/fuzztest/GetDisplayVersion_fuzzer/corpus/init create mode 100644 test/fuzztest/GetDisplayVersion_fuzzer/project.xml create mode 100644 test/fuzztest/GetFeatureVersion_fuzzer/GetFeatureVersion_fuzzer.cpp create mode 100644 test/fuzztest/GetFeatureVersion_fuzzer/GetFeatureVersion_fuzzer.h create mode 100644 test/fuzztest/GetFeatureVersion_fuzzer/corpus/init create mode 100644 test/fuzztest/GetFeatureVersion_fuzzer/project.xml create mode 100644 test/fuzztest/GetFirstApiVersion_fuzzer/GetFirstApiVersion_fuzzer.cpp create mode 100644 test/fuzztest/GetFirstApiVersion_fuzzer/GetFirstApiVersion_fuzzer.h create mode 100644 test/fuzztest/GetFirstApiVersion_fuzzer/corpus/init create mode 100644 test/fuzztest/GetFirstApiVersion_fuzzer/project.xml create mode 100644 test/fuzztest/GetHardwareModel_fuzzer/GetHardwareModel_fuzzer.cpp create mode 100644 test/fuzztest/GetHardwareModel_fuzzer/GetHardwareModel_fuzzer.h create mode 100644 test/fuzztest/GetHardwareModel_fuzzer/corpus/init create mode 100644 test/fuzztest/GetHardwareModel_fuzzer/project.xml create mode 100644 test/fuzztest/GetHardwareProfile_fuzzer/GetHardwareProfile_fuzzer.cpp create mode 100644 test/fuzztest/GetHardwareProfile_fuzzer/GetHardwareProfile_fuzzer.h create mode 100644 test/fuzztest/GetHardwareProfile_fuzzer/corpus/init create mode 100644 test/fuzztest/GetHardwareProfile_fuzzer/project.xml create mode 100644 test/fuzztest/GetIncrementalVersion_fuzzer/GetIncrementalVersion_fuzzer.cpp create mode 100644 test/fuzztest/GetIncrementalVersion_fuzzer/GetIncrementalVersion_fuzzer.h create mode 100644 test/fuzztest/GetIncrementalVersion_fuzzer/corpus/init create mode 100644 test/fuzztest/GetIncrementalVersion_fuzzer/project.xml create mode 100644 test/fuzztest/GetIntParameterC_fuzzer/GetIntParameterC_fuzzer.cpp create mode 100644 test/fuzztest/GetIntParameterC_fuzzer/GetIntParameterC_fuzzer.h create mode 100644 test/fuzztest/GetIntParameterC_fuzzer/corpus/init create mode 100644 test/fuzztest/GetIntParameterC_fuzzer/project.xml create mode 100644 test/fuzztest/GetIntParameterCpp_fuzzer/GetIntParameterCpp_fuzzer.cpp create mode 100644 test/fuzztest/GetIntParameterCpp_fuzzer/GetIntParameterCpp_fuzzer.h create mode 100644 test/fuzztest/GetIntParameterCpp_fuzzer/corpus/init create mode 100644 test/fuzztest/GetIntParameterCpp_fuzzer/project.xml create mode 100644 test/fuzztest/GetMajorVersion_fuzzer/GetMajorVersion_fuzzer.cpp create mode 100644 test/fuzztest/GetMajorVersion_fuzzer/GetMajorVersion_fuzzer.h create mode 100644 test/fuzztest/GetMajorVersion_fuzzer/corpus/init create mode 100644 test/fuzztest/GetMajorVersion_fuzzer/project.xml create mode 100644 test/fuzztest/GetManufacture_fuzzer/GetManufacture_fuzzer.cpp create mode 100644 test/fuzztest/GetManufacture_fuzzer/GetManufacture_fuzzer.h create mode 100644 test/fuzztest/GetManufacture_fuzzer/corpus/init create mode 100644 test/fuzztest/GetManufacture_fuzzer/project.xml create mode 100644 test/fuzztest/GetMarketName_fuzzer/GetMarketName_fuzzer.cpp create mode 100644 test/fuzztest/GetMarketName_fuzzer/GetMarketName_fuzzer.h create mode 100644 test/fuzztest/GetMarketName_fuzzer/corpus/init create mode 100644 test/fuzztest/GetMarketName_fuzzer/project.xml create mode 100644 test/fuzztest/GetMountStatusForMountPoint_fuzzer/GetMountStatusForMountPoint_fuzzer.cpp create mode 100644 test/fuzztest/GetMountStatusForMountPoint_fuzzer/GetMountStatusForMountPoint_fuzzer.h create mode 100644 test/fuzztest/GetMountStatusForMountPoint_fuzzer/corpus/init create mode 100644 test/fuzztest/GetMountStatusForMountPoint_fuzzer/project.xml create mode 100644 test/fuzztest/GetOSFullName_fuzzer/GetOSFullName_fuzzer.cpp create mode 100644 test/fuzztest/GetOSFullName_fuzzer/GetOSFullName_fuzzer.h create mode 100644 test/fuzztest/GetOSFullName_fuzzer/corpus/init create mode 100644 test/fuzztest/GetOSFullName_fuzzer/project.xml create mode 100644 test/fuzztest/GetOsReleaseType_fuzzer/GetOsReleaseType_fuzzer.cpp create mode 100644 test/fuzztest/GetOsReleaseType_fuzzer/GetOsReleaseType_fuzzer.h create mode 100644 test/fuzztest/GetOsReleaseType_fuzzer/corpus/init create mode 100644 test/fuzztest/GetOsReleaseType_fuzzer/project.xml rename test/fuzztest/{systemgetparameter_fuzzer/systemgetparameter_fuzzer.cpp => GetParameterC_fuzzer/GetParameterC_fuzzer.cpp} (70%) create mode 100644 test/fuzztest/GetParameterC_fuzzer/GetParameterC_fuzzer.h create mode 100644 test/fuzztest/GetParameterC_fuzzer/corpus/init create mode 100644 test/fuzztest/GetParameterC_fuzzer/project.xml rename test/fuzztest/{systemgetparametercommitid_fuzzer/systemgetparametercommitid_fuzzer.cpp => GetParameterCommitId_fuzzer/GetParameterCommitId_fuzzer.cpp} (73%) create mode 100644 test/fuzztest/GetParameterCommitId_fuzzer/GetParameterCommitId_fuzzer.h create mode 100644 test/fuzztest/GetParameterCommitId_fuzzer/corpus/init create mode 100644 test/fuzztest/GetParameterCommitId_fuzzer/project.xml create mode 100644 test/fuzztest/GetParameterCpp_fuzzer/GetParameterCpp_fuzzer.cpp create mode 100644 test/fuzztest/GetParameterCpp_fuzzer/GetParameterCpp_fuzzer.h create mode 100644 test/fuzztest/GetParameterCpp_fuzzer/corpus/init create mode 100644 test/fuzztest/GetParameterCpp_fuzzer/project.xml rename test/fuzztest/{systemgetparametername_fuzzer/systemgetparametername_fuzzer.cpp => GetParameterName_fuzzer/GetParameterName_fuzzer.cpp} (75%) create mode 100644 test/fuzztest/GetParameterName_fuzzer/GetParameterName_fuzzer.h create mode 100644 test/fuzztest/GetParameterName_fuzzer/corpus/init create mode 100644 test/fuzztest/GetParameterName_fuzzer/project.xml rename test/fuzztest/{systemgetparametervalue_fuzzer/systemgetparametervalue_fuzzer.cpp => GetParameterValue_fuzzer/GetParameterValue_fuzzer.cpp} (77%) create mode 100644 test/fuzztest/GetParameterValue_fuzzer/GetParameterValue_fuzzer.h create mode 100644 test/fuzztest/GetParameterValue_fuzzer/corpus/init create mode 100644 test/fuzztest/GetParameterValue_fuzzer/project.xml create mode 100644 test/fuzztest/GetProductModel_fuzzer/GetProductModel_fuzzer.cpp create mode 100644 test/fuzztest/GetProductModel_fuzzer/GetProductModel_fuzzer.h create mode 100644 test/fuzztest/GetProductModel_fuzzer/corpus/init create mode 100644 test/fuzztest/GetProductModel_fuzzer/project.xml create mode 100644 test/fuzztest/GetProductSeries_fuzzer/GetProductSeries_fuzzer.cpp create mode 100644 test/fuzztest/GetProductSeries_fuzzer/GetProductSeries_fuzzer.h create mode 100644 test/fuzztest/GetProductSeries_fuzzer/corpus/init create mode 100644 test/fuzztest/GetProductSeries_fuzzer/project.xml create mode 100644 test/fuzztest/GetSdkApiVersion_fuzzer/GetSdkApiVersion_fuzzer.cpp create mode 100644 test/fuzztest/GetSdkApiVersion_fuzzer/GetSdkApiVersion_fuzzer.h create mode 100644 test/fuzztest/GetSdkApiVersion_fuzzer/corpus/init create mode 100644 test/fuzztest/GetSdkApiVersion_fuzzer/project.xml create mode 100644 test/fuzztest/GetSecurityPatchTag_fuzzer/GetSecurityPatchTag_fuzzer.cpp create mode 100644 test/fuzztest/GetSecurityPatchTag_fuzzer/GetSecurityPatchTag_fuzzer.h create mode 100644 test/fuzztest/GetSecurityPatchTag_fuzzer/corpus/init create mode 100644 test/fuzztest/GetSecurityPatchTag_fuzzer/project.xml create mode 100644 test/fuzztest/GetSeniorVersion_fuzzer/GetSeniorVersion_fuzzer.cpp create mode 100644 test/fuzztest/GetSeniorVersion_fuzzer/GetSeniorVersion_fuzzer.h create mode 100644 test/fuzztest/GetSeniorVersion_fuzzer/corpus/init create mode 100644 test/fuzztest/GetSeniorVersion_fuzzer/project.xml create mode 100644 test/fuzztest/GetSerial_fuzzer/GetSerial_fuzzer.cpp create mode 100644 test/fuzztest/GetSerial_fuzzer/GetSerial_fuzzer.h create mode 100644 test/fuzztest/GetSerial_fuzzer/corpus/init create mode 100644 test/fuzztest/GetSerial_fuzzer/project.xml create mode 100644 test/fuzztest/GetSoftwareModel_fuzzer/GetSoftwareModel_fuzzer.cpp create mode 100644 test/fuzztest/GetSoftwareModel_fuzzer/GetSoftwareModel_fuzzer.h create mode 100644 test/fuzztest/GetSoftwareModel_fuzzer/corpus/init create mode 100644 test/fuzztest/GetSoftwareModel_fuzzer/project.xml create mode 100644 test/fuzztest/GetStringParameter_fuzzer/GetStringParameter_fuzzer.cpp rename test/fuzztest/{systemgetparameter_fuzzer/systemgetparameter_fuzzer.h => GetStringParameter_fuzzer/GetStringParameter_fuzzer.h} (87%) create mode 100644 test/fuzztest/GetStringParameter_fuzzer/corpus/init create mode 100644 test/fuzztest/GetStringParameter_fuzzer/project.xml create mode 100644 test/fuzztest/GetSystemCommitId_fuzzer/GetSystemCommitId_fuzzer.cpp create mode 100644 test/fuzztest/GetSystemCommitId_fuzzer/GetSystemCommitId_fuzzer.h create mode 100644 test/fuzztest/GetSystemCommitId_fuzzer/corpus/init create mode 100644 test/fuzztest/GetSystemCommitId_fuzzer/project.xml create mode 100644 test/fuzztest/GetUintParameterC_fuzzer/GetUintParameterC_fuzzer.cpp create mode 100644 test/fuzztest/GetUintParameterC_fuzzer/GetUintParameterC_fuzzer.h create mode 100644 test/fuzztest/GetUintParameterC_fuzzer/corpus/init create mode 100644 test/fuzztest/GetUintParameterC_fuzzer/project.xml create mode 100644 test/fuzztest/GetVersionId_fuzzer/GetVersionId_fuzzer.cpp create mode 100644 test/fuzztest/GetVersionId_fuzzer/GetVersionId_fuzzer.h create mode 100644 test/fuzztest/GetVersionId_fuzzer/corpus/init create mode 100644 test/fuzztest/GetVersionId_fuzzer/project.xml rename test/fuzztest/{systemsetparameter_fuzzer/systemsetparameter_fuzzer.cpp => HasSystemCapability_fuzzer/HasSystemCapability_fuzzer.cpp} (72%) create mode 100644 test/fuzztest/HasSystemCapability_fuzzer/HasSystemCapability_fuzzer.h create mode 100644 test/fuzztest/HasSystemCapability_fuzzer/corpus/init create mode 100644 test/fuzztest/HasSystemCapability_fuzzer/project.xml create mode 100644 test/fuzztest/HookMgrAddEx_fuzzer/HookMgrAddEx_fuzzer.cpp create mode 100644 test/fuzztest/HookMgrAddEx_fuzzer/HookMgrAddEx_fuzzer.h create mode 100644 test/fuzztest/HookMgrAddEx_fuzzer/corpus/init create mode 100644 test/fuzztest/HookMgrAddEx_fuzzer/project.xml create mode 100644 test/fuzztest/HookMgrAdd_fuzzer/HookMgrAdd_fuzzer.cpp create mode 100644 test/fuzztest/HookMgrAdd_fuzzer/HookMgrAdd_fuzzer.h create mode 100644 test/fuzztest/HookMgrAdd_fuzzer/corpus/init create mode 100644 test/fuzztest/HookMgrAdd_fuzzer/project.xml create mode 100644 test/fuzztest/HookMgrCreate_fuzzer/HookMgrCreate_fuzzer.cpp create mode 100644 test/fuzztest/HookMgrCreate_fuzzer/HookMgrCreate_fuzzer.h create mode 100644 test/fuzztest/HookMgrCreate_fuzzer/corpus/init create mode 100644 test/fuzztest/HookMgrCreate_fuzzer/project.xml create mode 100644 test/fuzztest/HookMgrDel_fuzzer/HookMgrDel_fuzzer.cpp create mode 100644 test/fuzztest/HookMgrDel_fuzzer/HookMgrDel_fuzzer.h create mode 100644 test/fuzztest/HookMgrDel_fuzzer/corpus/init create mode 100644 test/fuzztest/HookMgrDel_fuzzer/project.xml create mode 100644 test/fuzztest/HookMgrDestroy_fuzzer/HookMgrDestroy_fuzzer.cpp create mode 100644 test/fuzztest/HookMgrDestroy_fuzzer/HookMgrDestroy_fuzzer.h create mode 100644 test/fuzztest/HookMgrDestroy_fuzzer/corpus/init create mode 100644 test/fuzztest/HookMgrDestroy_fuzzer/project.xml create mode 100644 test/fuzztest/HookMgrExecute_fuzzer/HookMgrExecute_fuzzer.cpp create mode 100644 test/fuzztest/HookMgrExecute_fuzzer/HookMgrExecute_fuzzer.h create mode 100644 test/fuzztest/HookMgrExecute_fuzzer/corpus/init create mode 100644 test/fuzztest/HookMgrExecute_fuzzer/project.xml create mode 100644 test/fuzztest/HookMgrGetHooksCnt_fuzzer/HookMgrGetHooksCnt_fuzzer.cpp create mode 100644 test/fuzztest/HookMgrGetHooksCnt_fuzzer/HookMgrGetHooksCnt_fuzzer.h create mode 100644 test/fuzztest/HookMgrGetHooksCnt_fuzzer/corpus/init create mode 100644 test/fuzztest/HookMgrGetHooksCnt_fuzzer/project.xml create mode 100644 test/fuzztest/HookMgrGetStagesCnt_fuzzer/HookMgrGetStagesCnt_fuzzer.cpp create mode 100644 test/fuzztest/HookMgrGetStagesCnt_fuzzer/HookMgrGetStagesCnt_fuzzer.h create mode 100644 test/fuzztest/HookMgrGetStagesCnt_fuzzer/corpus/init create mode 100644 test/fuzztest/HookMgrGetStagesCnt_fuzzer/project.xml create mode 100644 test/fuzztest/HookMgrTraversal_fuzzer/HookMgrTraversal_fuzzer.cpp create mode 100644 test/fuzztest/HookMgrTraversal_fuzzer/HookMgrTraversal_fuzzer.h create mode 100644 test/fuzztest/HookMgrTraversal_fuzzer/corpus/init create mode 100644 test/fuzztest/HookMgrTraversal_fuzzer/project.xml create mode 100644 test/fuzztest/IsSupportedFilesystem_fuzzer/IsSupportedFilesystem_fuzzer.cpp create mode 100644 test/fuzztest/IsSupportedFilesystem_fuzzer/IsSupportedFilesystem_fuzzer.h create mode 100644 test/fuzztest/IsSupportedFilesystem_fuzzer/corpus/init create mode 100644 test/fuzztest/IsSupportedFilesystem_fuzzer/project.xml create mode 100644 test/fuzztest/LoadFscryptPolicy_fuzzer/LoadFscryptPolicy_fuzzer.cpp create mode 100644 test/fuzztest/LoadFscryptPolicy_fuzzer/LoadFscryptPolicy_fuzzer.h create mode 100644 test/fuzztest/LoadFscryptPolicy_fuzzer/corpus/init create mode 100644 test/fuzztest/LoadFscryptPolicy_fuzzer/project.xml create mode 100644 test/fuzztest/LoadFstabFromCommandLine_fuzzer/LoadFstabFromCommandLine_fuzzer.cpp create mode 100644 test/fuzztest/LoadFstabFromCommandLine_fuzzer/LoadFstabFromCommandLine_fuzzer.h create mode 100644 test/fuzztest/LoadFstabFromCommandLine_fuzzer/corpus/init create mode 100644 test/fuzztest/LoadFstabFromCommandLine_fuzzer/project.xml create mode 100644 test/fuzztest/ModuleMgrCreate_fuzzer/ModuleMgrCreate_fuzzer.cpp create mode 100644 test/fuzztest/ModuleMgrCreate_fuzzer/ModuleMgrCreate_fuzzer.h create mode 100644 test/fuzztest/ModuleMgrCreate_fuzzer/corpus/init create mode 100644 test/fuzztest/ModuleMgrCreate_fuzzer/project.xml create mode 100644 test/fuzztest/ModuleMgrDestroy_fuzzer/ModuleMgrDestroy_fuzzer.cpp create mode 100644 test/fuzztest/ModuleMgrDestroy_fuzzer/ModuleMgrDestroy_fuzzer.h create mode 100644 test/fuzztest/ModuleMgrDestroy_fuzzer/corpus/init create mode 100644 test/fuzztest/ModuleMgrDestroy_fuzzer/project.xml create mode 100644 test/fuzztest/ModuleMgrGetCnt_fuzzer/ModuleMgrGetCnt_fuzzer.cpp create mode 100644 test/fuzztest/ModuleMgrGetCnt_fuzzer/ModuleMgrGetCnt_fuzzer.h create mode 100644 test/fuzztest/ModuleMgrGetCnt_fuzzer/corpus/init create mode 100644 test/fuzztest/ModuleMgrGetCnt_fuzzer/project.xml create mode 100644 test/fuzztest/ModuleMgrInstall_fuzzer/ModuleMgrInstall_fuzzer.cpp create mode 100644 test/fuzztest/ModuleMgrInstall_fuzzer/ModuleMgrInstall_fuzzer.h create mode 100644 test/fuzztest/ModuleMgrInstall_fuzzer/corpus/init create mode 100644 test/fuzztest/ModuleMgrInstall_fuzzer/project.xml create mode 100644 test/fuzztest/ModuleMgrScan_fuzzer/ModuleMgrScan_fuzzer.cpp create mode 100644 test/fuzztest/ModuleMgrScan_fuzzer/ModuleMgrScan_fuzzer.h create mode 100644 test/fuzztest/ModuleMgrScan_fuzzer/corpus/init create mode 100644 test/fuzztest/ModuleMgrScan_fuzzer/project.xml create mode 100644 test/fuzztest/ModuleMgrTraversal_fuzzer/ModuleMgrTraversal_fuzzer.cpp create mode 100644 test/fuzztest/ModuleMgrTraversal_fuzzer/ModuleMgrTraversal_fuzzer.h create mode 100644 test/fuzztest/ModuleMgrTraversal_fuzzer/corpus/init create mode 100644 test/fuzztest/ModuleMgrTraversal_fuzzer/project.xml create mode 100644 test/fuzztest/ModuleMgrUninstall_fuzzer/ModuleMgrUninstall_fuzzer.cpp create mode 100644 test/fuzztest/ModuleMgrUninstall_fuzzer/ModuleMgrUninstall_fuzzer.h create mode 100644 test/fuzztest/ModuleMgrUninstall_fuzzer/corpus/init create mode 100644 test/fuzztest/ModuleMgrUninstall_fuzzer/project.xml rename test/fuzztest/{mountallfstab_fuzzer/mountallfstab_fuzzer.cpp => MountAllWithFstabFile_fuzzer/MountAllWithFstabFile_fuzzer.cpp} (91%) rename test/fuzztest/{mountallfstab_fuzzer/mountallfstab_fuzzer.h => MountAllWithFstabFile_fuzzer/MountAllWithFstabFile_fuzzer.h} (87%) create mode 100644 test/fuzztest/MountAllWithFstabFile_fuzzer/corpus/init create mode 100644 test/fuzztest/MountAllWithFstabFile_fuzzer/project.xml create mode 100644 test/fuzztest/MountAllWithFstab_fuzzer/MountAllWithFstab_fuzzer.cpp create mode 100644 test/fuzztest/MountAllWithFstab_fuzzer/MountAllWithFstab_fuzzer.h create mode 100644 test/fuzztest/MountAllWithFstab_fuzzer/corpus/init create mode 100644 test/fuzztest/MountAllWithFstab_fuzzer/project.xml create mode 100644 test/fuzztest/MountOneItem_fuzzer/MountOneItem_fuzzer.cpp create mode 100644 test/fuzztest/MountOneItem_fuzzer/MountOneItem_fuzzer.h create mode 100644 test/fuzztest/MountOneItem_fuzzer/corpus/init create mode 100644 test/fuzztest/MountOneItem_fuzzer/project.xml create mode 100644 test/fuzztest/ParseFstabPerLine_fuzzer/ParseFstabPerLine_fuzzer.cpp create mode 100644 test/fuzztest/ParseFstabPerLine_fuzzer/ParseFstabPerLine_fuzzer.h create mode 100644 test/fuzztest/ParseFstabPerLine_fuzzer/corpus/init create mode 100644 test/fuzztest/ParseFstabPerLine_fuzzer/project.xml create mode 100644 test/fuzztest/ReadFstabFromFile_fuzzer/ReadFstabFromFile_fuzzer.cpp create mode 100644 test/fuzztest/ReadFstabFromFile_fuzzer/ReadFstabFromFile_fuzzer.h create mode 100644 test/fuzztest/ReadFstabFromFile_fuzzer/corpus/init create mode 100644 test/fuzztest/ReadFstabFromFile_fuzzer/project.xml create mode 100644 test/fuzztest/ReceiveFds_fuzzer/ReceiveFds_fuzzer.cpp create mode 100644 test/fuzztest/ReceiveFds_fuzzer/ReceiveFds_fuzzer.h create mode 100644 test/fuzztest/ReceiveFds_fuzzer/corpus/init create mode 100644 test/fuzztest/ReceiveFds_fuzzer/project.xml create mode 100644 test/fuzztest/ReleaseFstab_fuzzer/ReleaseFstab_fuzzer.cpp create mode 100644 test/fuzztest/ReleaseFstab_fuzzer/ReleaseFstab_fuzzer.h create mode 100644 test/fuzztest/ReleaseFstab_fuzzer/corpus/init create mode 100644 test/fuzztest/ReleaseFstab_fuzzer/project.xml create mode 100644 test/fuzztest/RemoveParameterWatcher_fuzzer/RemoveParameterWatcher_fuzzer.cpp create mode 100644 test/fuzztest/RemoveParameterWatcher_fuzzer/RemoveParameterWatcher_fuzzer.h create mode 100644 test/fuzztest/RemoveParameterWatcher_fuzzer/corpus/init create mode 100644 test/fuzztest/RemoveParameterWatcher_fuzzer/project.xml create mode 100644 test/fuzztest/ServiceControlWithExtra_fuzzer/ServiceControlWithExtra_fuzzer.cpp create mode 100644 test/fuzztest/ServiceControlWithExtra_fuzzer/ServiceControlWithExtra_fuzzer.h create mode 100644 test/fuzztest/ServiceControlWithExtra_fuzzer/corpus/init create mode 100644 test/fuzztest/ServiceControlWithExtra_fuzzer/project.xml create mode 100644 test/fuzztest/ServiceControl_fuzzer/ServiceControl_fuzzer.cpp create mode 100644 test/fuzztest/ServiceControl_fuzzer/ServiceControl_fuzzer.h create mode 100644 test/fuzztest/ServiceControl_fuzzer/corpus/init create mode 100644 test/fuzztest/ServiceControl_fuzzer/project.xml create mode 100644 test/fuzztest/ServiceGetFd_fuzzer/ServiceGetFd_fuzzer.cpp create mode 100644 test/fuzztest/ServiceGetFd_fuzzer/ServiceGetFd_fuzzer.h create mode 100644 test/fuzztest/ServiceGetFd_fuzzer/corpus/init create mode 100644 test/fuzztest/ServiceGetFd_fuzzer/project.xml create mode 100644 test/fuzztest/ServiceSaveFdWithPoll_fuzzer/ServiceSaveFdWithPoll_fuzzer.cpp create mode 100644 test/fuzztest/ServiceSaveFdWithPoll_fuzzer/ServiceSaveFdWithPoll_fuzzer.h create mode 100644 test/fuzztest/ServiceSaveFdWithPoll_fuzzer/corpus/init create mode 100644 test/fuzztest/ServiceSaveFdWithPoll_fuzzer/project.xml create mode 100644 test/fuzztest/ServiceSaveFd_fuzzer/ServiceSaveFd_fuzzer.cpp create mode 100644 test/fuzztest/ServiceSaveFd_fuzzer/ServiceSaveFd_fuzzer.h create mode 100644 test/fuzztest/ServiceSaveFd_fuzzer/corpus/init create mode 100644 test/fuzztest/ServiceSaveFd_fuzzer/project.xml create mode 100644 test/fuzztest/ServiceSetReady_fuzzer/ServiceSetReady_fuzzer.cpp create mode 100644 test/fuzztest/ServiceSetReady_fuzzer/ServiceSetReady_fuzzer.h create mode 100644 test/fuzztest/ServiceSetReady_fuzzer/corpus/init create mode 100644 test/fuzztest/ServiceSetReady_fuzzer/project.xml create mode 100644 test/fuzztest/ServiceWaitForStatus_fuzzer/ServiceWaitForStatus_fuzzer.cpp create mode 100644 test/fuzztest/ServiceWaitForStatus_fuzzer/ServiceWaitForStatus_fuzzer.h create mode 100644 test/fuzztest/ServiceWaitForStatus_fuzzer/corpus/init create mode 100644 test/fuzztest/ServiceWaitForStatus_fuzzer/project.xml create mode 100644 test/fuzztest/ServiceWatchForStatus_fuzzer/ServiceWatchForStatus_fuzzer.cpp create mode 100644 test/fuzztest/ServiceWatchForStatus_fuzzer/ServiceWatchForStatus_fuzzer.h create mode 100644 test/fuzztest/ServiceWatchForStatus_fuzzer/corpus/init create mode 100644 test/fuzztest/ServiceWatchForStatus_fuzzer/project.xml create mode 100644 test/fuzztest/SetParameterC_fuzzer/SetParameterC_fuzzer.cpp create mode 100644 test/fuzztest/SetParameterC_fuzzer/SetParameterC_fuzzer.h create mode 100644 test/fuzztest/SetParameterC_fuzzer/corpus/init create mode 100644 test/fuzztest/SetParameterC_fuzzer/project.xml create mode 100644 test/fuzztest/SetParameterCpp_fuzzer/SetParameterCpp_fuzzer.cpp create mode 100644 test/fuzztest/SetParameterCpp_fuzzer/SetParameterCpp_fuzzer.h create mode 100644 test/fuzztest/SetParameterCpp_fuzzer/corpus/init create mode 100644 test/fuzztest/SetParameterCpp_fuzzer/project.xml rename test/fuzztest/{systemwaitparameter_fuzzer/systemwaitparameter_fuzzer.cpp => StartServiceByTimer_fuzzer/StartServiceByTimer_fuzzer.cpp} (71%) create mode 100644 test/fuzztest/StartServiceByTimer_fuzzer/StartServiceByTimer_fuzzer.h create mode 100644 test/fuzztest/StartServiceByTimer_fuzzer/corpus/init create mode 100644 test/fuzztest/StartServiceByTimer_fuzzer/project.xml create mode 100644 test/fuzztest/StopServiceTimer_fuzzer/StopServiceTimer_fuzzer.cpp create mode 100644 test/fuzztest/StopServiceTimer_fuzzer/StopServiceTimer_fuzzer.h create mode 100644 test/fuzztest/StopServiceTimer_fuzzer/corpus/init create mode 100644 test/fuzztest/StopServiceTimer_fuzzer/project.xml rename test/fuzztest/{umountallfstab_fuzzer/umountallfstab_fuzzer.cpp => UmountAllWithFstabFile_fuzzer/UmountAllWithFstabFile_fuzzer.cpp} (91%) rename test/fuzztest/{umountallfstab_fuzzer/umountallfstab_fuzzer.h => UmountAllWithFstabFile_fuzzer/UmountAllWithFstabFile_fuzzer.h} (87%) create mode 100644 test/fuzztest/UmountAllWithFstabFile_fuzzer/corpus/init create mode 100644 test/fuzztest/UmountAllWithFstabFile_fuzzer/project.xml create mode 100644 test/fuzztest/WaitParameter_fuzzer/WaitParameter_fuzzer.cpp create mode 100644 test/fuzztest/WaitParameter_fuzzer/WaitParameter_fuzzer.h create mode 100644 test/fuzztest/WaitParameter_fuzzer/corpus/init create mode 100644 test/fuzztest/WaitParameter_fuzzer/project.xml rename test/fuzztest/{systemwatchparameter_fuzzer/systemwatchparameter_fuzzer.cpp => WatchParameter_fuzzer/WatchParameter_fuzzer.cpp} (73%) create mode 100644 test/fuzztest/WatchParameter_fuzzer/WatchParameter_fuzzer.h create mode 100644 test/fuzztest/WatchParameter_fuzzer/corpus/init create mode 100644 test/fuzztest/WatchParameter_fuzzer/project.xml delete mode 100644 test/fuzztest/systemfindparameter_fuzzer/systemfindparameter_fuzzer.h delete mode 100644 test/fuzztest/systemgetparametercommitid_fuzzer/systemgetparametercommitid_fuzzer.h delete mode 100644 test/fuzztest/systemgetparametername_fuzzer/project.xml delete mode 100644 test/fuzztest/systemgetparametername_fuzzer/systemgetparametername_fuzzer.h delete mode 100644 test/fuzztest/systemgetparametervalue_fuzzer/project.xml delete mode 100644 test/fuzztest/systemgetparametervalue_fuzzer/systemgetparametervalue_fuzzer.h delete mode 100644 test/fuzztest/systemsetparameter_fuzzer/project.xml delete mode 100644 test/fuzztest/systemsetparameter_fuzzer/systemsetparameter_fuzzer.h delete mode 100644 test/fuzztest/systemwaitparameter_fuzzer/project.xml delete mode 100644 test/fuzztest/systemwaitparameter_fuzzer/systemwaitparameter_fuzzer.h delete mode 100644 test/fuzztest/systemwatchparameter_fuzzer/project.xml delete mode 100644 test/fuzztest/systemwatchparameter_fuzzer/systemwatchparameter_fuzzer.h delete mode 100644 test/fuzztest/umountallfstab_fuzzer/project.xml diff --git a/interfaces/innerkits/control_fd/control_fd_service.c b/interfaces/innerkits/control_fd/control_fd_service.c index cef25547..69540d57 100644 --- a/interfaces/innerkits/control_fd/control_fd_service.c +++ b/interfaces/innerkits/control_fd/control_fd_service.c @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include #include diff --git a/test/fuzztest/AclGetDevUdid_fuzzer/AclGetDevUdid_fuzzer.cpp b/test/fuzztest/AclGetDevUdid_fuzzer/AclGetDevUdid_fuzzer.cpp new file mode 100644 index 00000000..860a594d --- /dev/null +++ b/test/fuzztest/AclGetDevUdid_fuzzer/AclGetDevUdid_fuzzer.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "AclGetDevUdid_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzAclGetDevUdid(const uint8_t* data, size_t size) + { + bool result = false; + char udid[65] = {0}; + int len = sizeof(udid); + if (!AclGetDevUdid(udid, len)) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzAclGetDevUdid(data, size); + return 0; +} diff --git a/test/fuzztest/AclGetDevUdid_fuzzer/AclGetDevUdid_fuzzer.h b/test/fuzztest/AclGetDevUdid_fuzzer/AclGetDevUdid_fuzzer.h new file mode 100644 index 00000000..5cf36c86 --- /dev/null +++ b/test/fuzztest/AclGetDevUdid_fuzzer/AclGetDevUdid_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ACL_GET_DEV_UDID_FUZZER_H +#define TEST_FUZZTEST_ACL_GET_DEV_UDID_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "AclGetDevUdid_fuzzer" +#endif diff --git a/test/fuzztest/mountallfstab_fuzzer/corpus/init b/test/fuzztest/AclGetDevUdid_fuzzer/corpus/init similarity index 100% rename from test/fuzztest/mountallfstab_fuzzer/corpus/init rename to test/fuzztest/AclGetDevUdid_fuzzer/corpus/init diff --git a/test/fuzztest/systemfindparameter_fuzzer/project.xml b/test/fuzztest/AclGetDevUdid_fuzzer/project.xml similarity index 94% rename from test/fuzztest/systemfindparameter_fuzzer/project.xml rename to test/fuzztest/AclGetDevUdid_fuzzer/project.xml index 428e0f27..949d03ef 100644 --- a/test/fuzztest/systemfindparameter_fuzzer/project.xml +++ b/test/fuzztest/AclGetDevUdid_fuzzer/project.xml @@ -1,5 +1,5 @@ - + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/CmdServiceProcessDelClient_fuzzer/CmdServiceProcessDelClient_fuzzer.cpp b/test/fuzztest/CmdServiceProcessDelClient_fuzzer/CmdServiceProcessDelClient_fuzzer.cpp new file mode 100644 index 00000000..8b4a1d6d --- /dev/null +++ b/test/fuzztest/CmdServiceProcessDelClient_fuzzer/CmdServiceProcessDelClient_fuzzer.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "CmdServiceProcessDelClient_fuzzer.h" +#include +#include "control_fd.h" + +namespace OHOS { + bool FuzzCmdServiceProcessDelClient(const uint8_t* data, size_t size) + { + CmdServiceProcessDelClient(1); + return true; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzCmdServiceProcessDelClient(data, size); + return 0; +} diff --git a/test/fuzztest/CmdServiceProcessDelClient_fuzzer/CmdServiceProcessDelClient_fuzzer.h b/test/fuzztest/CmdServiceProcessDelClient_fuzzer/CmdServiceProcessDelClient_fuzzer.h new file mode 100644 index 00000000..a024f183 --- /dev/null +++ b/test/fuzztest/CmdServiceProcessDelClient_fuzzer/CmdServiceProcessDelClient_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_CMD_SERVICE_PROCESS_DEL_CLIENT_FUZZER_H +#define TEST_FUZZTEST_CMD_SERVICE_PROCESS_DEL_CLIENT_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "CmdServiceProcessDelClient_fuzzer" +#endif diff --git a/test/fuzztest/systemgetparametervalue_fuzzer/corpus/init b/test/fuzztest/CmdServiceProcessDelClient_fuzzer/corpus/init similarity index 100% rename from test/fuzztest/systemgetparametervalue_fuzzer/corpus/init rename to test/fuzztest/CmdServiceProcessDelClient_fuzzer/corpus/init diff --git a/test/fuzztest/CmdServiceProcessDelClient_fuzzer/project.xml b/test/fuzztest/CmdServiceProcessDelClient_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/CmdServiceProcessDelClient_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/DoFormat_fuzzer/DoFormat_fuzzer.cpp b/test/fuzztest/DoFormat_fuzzer/DoFormat_fuzzer.cpp new file mode 100644 index 00000000..e52f02de --- /dev/null +++ b/test/fuzztest/DoFormat_fuzzer/DoFormat_fuzzer.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "DoFormat_fuzzer.h" +#include +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzDoFormat(const uint8_t* data, size_t size) + { + bool resule = false; + std::string str(reinterpret_cast(data), size); + if (!DoFormat(str.c_str(), str.c_str())) { + resule = true; + }; + return resule; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzDoFormat(data, size); + return 0; +} diff --git a/test/fuzztest/DoFormat_fuzzer/DoFormat_fuzzer.h b/test/fuzztest/DoFormat_fuzzer/DoFormat_fuzzer.h new file mode 100644 index 00000000..5841d32d --- /dev/null +++ b/test/fuzztest/DoFormat_fuzzer/DoFormat_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_DO_FORMAT_FUZZER_H +#define TEST_FUZZTEST_DO_FORMAT_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "DoFormat_fuzzer" +#endif diff --git a/test/fuzztest/systemsetparameter_fuzzer/corpus/init b/test/fuzztest/DoFormat_fuzzer/corpus/init similarity index 100% rename from test/fuzztest/systemsetparameter_fuzzer/corpus/init rename to test/fuzztest/DoFormat_fuzzer/corpus/init diff --git a/test/fuzztest/DoFormat_fuzzer/project.xml b/test/fuzztest/DoFormat_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/DoFormat_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/FindFstabItemForMountPoint_fuzzer/FindFstabItemForMountPoint_fuzzer.cpp b/test/fuzztest/FindFstabItemForMountPoint_fuzzer/FindFstabItemForMountPoint_fuzzer.cpp new file mode 100644 index 00000000..f6d1b52e --- /dev/null +++ b/test/fuzztest/FindFstabItemForMountPoint_fuzzer/FindFstabItemForMountPoint_fuzzer.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "FindFstabItemForMountPoint_fuzzer.h" +#include +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzFindFstabItemForMountPoint(const uint8_t* data, size_t size) + { + bool result = false; + FILE *pFile = nullptr; + pFile = fopen("fstab.test", "w+"); + if (pFile == nullptr) { + std::cout << "[fuzz] open file fstab.test failed"; + return false; + } + if (fwrite(data, 1, size, pFile) != size) { + std::cout << "[fuzz] write data to fstab.test failed"; + (void)fclose(pFile); + return false; + } + (void)fclose(pFile); + CloseStdout(); + Fstab *fstab = ReadFstabFromFile("fstab.test", false); + + std::string str(reinterpret_cast(data), size); + if (FindFstabItemForMountPoint(*fstab, str.c_str()) != nullptr) { + result = true; + }; + + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzFindFstabItemForMountPoint(data, size); + return 0; +} diff --git a/test/fuzztest/FindFstabItemForMountPoint_fuzzer/FindFstabItemForMountPoint_fuzzer.h b/test/fuzztest/FindFstabItemForMountPoint_fuzzer/FindFstabItemForMountPoint_fuzzer.h new file mode 100644 index 00000000..69f6ec03 --- /dev/null +++ b/test/fuzztest/FindFstabItemForMountPoint_fuzzer/FindFstabItemForMountPoint_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_FIND_FSTAB_ITEM_FOR_MOUNT_POINT_FUZZER_H +#define TEST_FUZZTEST_FIND_FSTAB_ITEM_FOR_MOUNT_POINT_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "FindFstabItemForMountPoint_fuzzer" +#endif diff --git a/test/fuzztest/systemwaitparameter_fuzzer/corpus/init b/test/fuzztest/FindFstabItemForMountPoint_fuzzer/corpus/init similarity index 100% rename from test/fuzztest/systemwaitparameter_fuzzer/corpus/init rename to test/fuzztest/FindFstabItemForMountPoint_fuzzer/corpus/init diff --git a/test/fuzztest/FindFstabItemForMountPoint_fuzzer/project.xml b/test/fuzztest/FindFstabItemForMountPoint_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/FindFstabItemForMountPoint_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/FindFstabItemForPath_fuzzer/FindFstabItemForPath_fuzzer.cpp b/test/fuzztest/FindFstabItemForPath_fuzzer/FindFstabItemForPath_fuzzer.cpp new file mode 100644 index 00000000..d3d2d109 --- /dev/null +++ b/test/fuzztest/FindFstabItemForPath_fuzzer/FindFstabItemForPath_fuzzer.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "FindFstabItemForPath_fuzzer.h" +#include +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzFindFstabItemForPath(const uint8_t* data, size_t size) + { + bool result = false; + FILE *pFile = nullptr; + pFile = fopen("fstab.test", "w+"); + if (pFile == nullptr) { + std::cout << "[fuzz] open file fstab.test failed"; + return false; + } + if (fwrite(data, 1, size, pFile) != size) { + std::cout << "[fuzz] write data to fstab.test failed"; + (void)fclose(pFile); + return false; + } + (void)fclose(pFile); + CloseStdout(); + Fstab *fstab = ReadFstabFromFile("fstab.test", false); + + std::string str(reinterpret_cast(data), size); + if (FindFstabItemForPath(*fstab, str.c_str()) != nullptr) { + result = true; + }; + + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzFindFstabItemForPath(data, size); + return 0; +} diff --git a/test/fuzztest/FindFstabItemForPath_fuzzer/FindFstabItemForPath_fuzzer.h b/test/fuzztest/FindFstabItemForPath_fuzzer/FindFstabItemForPath_fuzzer.h new file mode 100644 index 00000000..5bcaed37 --- /dev/null +++ b/test/fuzztest/FindFstabItemForPath_fuzzer/FindFstabItemForPath_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_FIND_FSTAB_ITEM_FOR_PATH_FUZZER_H +#define TEST_FUZZTEST_FIND_FSTAB_ITEM_FOR_PATH_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "FindFstabItemForPath_fuzzer" +#endif diff --git a/test/fuzztest/systemwatchparameter_fuzzer/corpus/init b/test/fuzztest/FindFstabItemForPath_fuzzer/corpus/init similarity index 100% rename from test/fuzztest/systemwatchparameter_fuzzer/corpus/init rename to test/fuzztest/FindFstabItemForPath_fuzzer/corpus/init diff --git a/test/fuzztest/FindFstabItemForPath_fuzzer/project.xml b/test/fuzztest/FindFstabItemForPath_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/FindFstabItemForPath_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/systemfindparameter_fuzzer/systemfindparameter_fuzzer.cpp b/test/fuzztest/FindParameter_fuzzer/FindParameter_fuzzer.cpp similarity index 70% rename from test/fuzztest/systemfindparameter_fuzzer/systemfindparameter_fuzzer.cpp rename to test/fuzztest/FindParameter_fuzzer/FindParameter_fuzzer.cpp index 0f9c1912..e876e0c2 100644 --- a/test/fuzztest/systemfindparameter_fuzzer/systemfindparameter_fuzzer.cpp +++ b/test/fuzztest/FindParameter_fuzzer/FindParameter_fuzzer.cpp @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,18 +13,16 @@ * limitations under the License. */ -#include "systemfindparameter_fuzzer.h" +#include "FindParameter_fuzzer.h" #include -#include "init_param.h" - -static ParamHandle handle; +#include "parameter.h" namespace OHOS { - bool FuzzSystemFindParameter(const uint8_t* data, size_t size) + bool FuzzFindParameter(const uint8_t* data, size_t size) { bool result = false; std::string str(reinterpret_cast(data), size); - if (!SystemFindParameter(str.c_str(), &handle)) { + if (!FindParameter(str.c_str())) { result = true; } return result; @@ -35,6 +33,6 @@ namespace OHOS { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ - OHOS::FuzzSystemFindParameter(data, size); + OHOS::FuzzFindParameter(data, size); return 0; } diff --git a/test/fuzztest/FindParameter_fuzzer/FindParameter_fuzzer.h b/test/fuzztest/FindParameter_fuzzer/FindParameter_fuzzer.h new file mode 100644 index 00000000..15e35b67 --- /dev/null +++ b/test/fuzztest/FindParameter_fuzzer/FindParameter_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_FINDPARAMETER_FUZZER_H +#define TEST_FUZZTEST_FINDPARAMETER_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "FindParameter_fuzzer" +#endif diff --git a/test/fuzztest/umountallfstab_fuzzer/corpus/init b/test/fuzztest/FindParameter_fuzzer/corpus/init similarity index 100% rename from test/fuzztest/umountallfstab_fuzzer/corpus/init rename to test/fuzztest/FindParameter_fuzzer/corpus/init diff --git a/test/fuzztest/FindParameter_fuzzer/project.xml b/test/fuzztest/FindParameter_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/FindParameter_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetAbiList_fuzzer/GetAbiList_fuzzer.cpp b/test/fuzztest/GetAbiList_fuzzer/GetAbiList_fuzzer.cpp new file mode 100644 index 00000000..b80fe2a7 --- /dev/null +++ b/test/fuzztest/GetAbiList_fuzzer/GetAbiList_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetAbiList_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetAbiList(const uint8_t* data, size_t size) + { + bool result = false; + if (GetAbiList() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetAbiList(data, size); + return 0; +} diff --git a/test/fuzztest/GetAbiList_fuzzer/GetAbiList_fuzzer.h b/test/fuzztest/GetAbiList_fuzzer/GetAbiList_fuzzer.h new file mode 100644 index 00000000..7ba393e1 --- /dev/null +++ b/test/fuzztest/GetAbiList_fuzzer/GetAbiList_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_ABILIST_H +#define TEST_FUZZTEST_GET_ABILIST_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetAbiList_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetAbiList_fuzzer/corpus/init b/test/fuzztest/GetAbiList_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetAbiList_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetAbiList_fuzzer/project.xml b/test/fuzztest/GetAbiList_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetAbiList_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetBlockDeviceByMountPoint_fuzzer/GetBlockDeviceByMountPoint_fuzzer.cpp b/test/fuzztest/GetBlockDeviceByMountPoint_fuzzer/GetBlockDeviceByMountPoint_fuzzer.cpp new file mode 100644 index 00000000..fcb5b1b9 --- /dev/null +++ b/test/fuzztest/GetBlockDeviceByMountPoint_fuzzer/GetBlockDeviceByMountPoint_fuzzer.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetBlockDeviceByMountPoint_fuzzer.h" +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzGetBlockDeviceByMountPoint(const uint8_t* data, size_t size) + { + bool result = false; + FILE *pFile = nullptr; + pFile = fopen("fstab.test", "w+"); + if (pFile == nullptr) { + std::cout << "[fuzz] open file fstab.test failed"; + return false; + } + if (fwrite(data, 1, size, pFile) != size) { + std::cout << "[fuzz] write data to fstab.test failed"; + (void)fclose(pFile); + return false; + } + (void)fclose(pFile); + CloseStdout(); + const Fstab *fstab = ReadFstabFromFile("fstab.test", false); + std::string str(reinterpret_cast(data), size); + char deviceName[100] = {0}; + int length = sizeof(deviceName); + if (!GetBlockDeviceByMountPoint(str.c_str(), fstab, deviceName, length)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetBlockDeviceByMountPoint(data, size); + return 0; +} diff --git a/test/fuzztest/GetBlockDeviceByMountPoint_fuzzer/GetBlockDeviceByMountPoint_fuzzer.h b/test/fuzztest/GetBlockDeviceByMountPoint_fuzzer/GetBlockDeviceByMountPoint_fuzzer.h new file mode 100644 index 00000000..1b33e1ac --- /dev/null +++ b/test/fuzztest/GetBlockDeviceByMountPoint_fuzzer/GetBlockDeviceByMountPoint_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_BLOCK_DEVICE_BY_MOUNT_POINT_FUZZER_H +#define TEST_FUZZTEST_GET_BLOCK_DEVICE_BY_MOUNT_POINT_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetBlockDeviceByMountPoint_fuzzer" +#endif diff --git a/test/fuzztest/GetBlockDeviceByMountPoint_fuzzer/corpus/init b/test/fuzztest/GetBlockDeviceByMountPoint_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetBlockDeviceByMountPoint_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetBlockDeviceByMountPoint_fuzzer/project.xml b/test/fuzztest/GetBlockDeviceByMountPoint_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetBlockDeviceByMountPoint_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetBlockDeviceByName_fuzzer/GetBlockDeviceByName_fuzzer.cpp b/test/fuzztest/GetBlockDeviceByName_fuzzer/GetBlockDeviceByName_fuzzer.cpp new file mode 100644 index 00000000..9a5bf808 --- /dev/null +++ b/test/fuzztest/GetBlockDeviceByName_fuzzer/GetBlockDeviceByName_fuzzer.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetBlockDeviceByName_fuzzer.h" +#include +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzGetBlockDeviceByName(const uint8_t* data, size_t size) + { + bool result = false; + FILE *pFile = nullptr; + pFile = fopen("fstab.test", "w+"); + if (pFile == nullptr) { + std::cout << "[fuzz] open file fstab.test failed"; + return false; + } + if (fwrite(data, 1, size, pFile) != size) { + std::cout << "[fuzz] write data to fstab.test failed"; + (void)fclose(pFile); + return false; + } + (void)fclose(pFile); + CloseStdout(); + const Fstab *fstab = ReadFstabFromFile("fstab.test", false); + + std::string str(reinterpret_cast(data), size); + char miscDev[1024] = {0}; + size_t len = sizeof(miscDev); + + if (GetBlockDeviceByName(str.c_str(), fstab, miscDev, len)) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetBlockDeviceByName(data, size); + return 0; +} diff --git a/test/fuzztest/GetBlockDeviceByName_fuzzer/GetBlockDeviceByName_fuzzer.h b/test/fuzztest/GetBlockDeviceByName_fuzzer/GetBlockDeviceByName_fuzzer.h new file mode 100644 index 00000000..c203640c --- /dev/null +++ b/test/fuzztest/GetBlockDeviceByName_fuzzer/GetBlockDeviceByName_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_BLOCK_DEVICE_NAME_FUZZER_H +#define TEST_FUZZTEST_GET_BLOCK_DEVICE_NAME_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetBlockDeviceByName_fuzzer" +#endif diff --git a/test/fuzztest/GetBlockDeviceByName_fuzzer/corpus/init b/test/fuzztest/GetBlockDeviceByName_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetBlockDeviceByName_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetBlockDeviceByName_fuzzer/project.xml b/test/fuzztest/GetBlockDeviceByName_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetBlockDeviceByName_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetBlockDevicePath_fuzzer/GetBlockDevicePath_fuzzer.cpp b/test/fuzztest/GetBlockDevicePath_fuzzer/GetBlockDevicePath_fuzzer.cpp new file mode 100644 index 00000000..8758afae --- /dev/null +++ b/test/fuzztest/GetBlockDevicePath_fuzzer/GetBlockDevicePath_fuzzer.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetBlockDevicePath_fuzzer.h" +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzGetBlockDevicePath(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + + if (!GetBlockDevicePath(str.c_str(), nullptr, size)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetBlockDevicePath(data, size); + return 0; +} diff --git a/test/fuzztest/GetBlockDevicePath_fuzzer/GetBlockDevicePath_fuzzer.h b/test/fuzztest/GetBlockDevicePath_fuzzer/GetBlockDevicePath_fuzzer.h new file mode 100644 index 00000000..ebfa7cc5 --- /dev/null +++ b/test/fuzztest/GetBlockDevicePath_fuzzer/GetBlockDevicePath_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_BLOCK_DEVICE_PATH_FUZZER_H +#define TEST_FUZZTEST_GET_BLOCK_DEVICE_PATH_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetBlockDevicePath_fuzzer" +#endif diff --git a/test/fuzztest/GetBlockDevicePath_fuzzer/corpus/init b/test/fuzztest/GetBlockDevicePath_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetBlockDevicePath_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetBlockDevicePath_fuzzer/project.xml b/test/fuzztest/GetBlockDevicePath_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetBlockDevicePath_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetBoolParameterCpp_fuzzer/GetBoolParameterCpp_fuzzer.cpp b/test/fuzztest/GetBoolParameterCpp_fuzzer/GetBoolParameterCpp_fuzzer.cpp new file mode 100644 index 00000000..92f5c090 --- /dev/null +++ b/test/fuzztest/GetBoolParameterCpp_fuzzer/GetBoolParameterCpp_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetBoolParameterCpp_fuzzer.h" +#include +#include "parameters.h" + +namespace OHOS { + bool FuzzGetBoolParameter(const uint8_t* data, size_t size) + { + bool result = false; + std::string key(reinterpret_cast(data), size); + if (system::GetBoolParameter(key, false)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetBoolParameter(data, size); + return 0; +} diff --git a/test/fuzztest/GetBoolParameterCpp_fuzzer/GetBoolParameterCpp_fuzzer.h b/test/fuzztest/GetBoolParameterCpp_fuzzer/GetBoolParameterCpp_fuzzer.h new file mode 100644 index 00000000..0c63b840 --- /dev/null +++ b/test/fuzztest/GetBoolParameterCpp_fuzzer/GetBoolParameterCpp_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_BOOL_PARAMETER_CPP_FUZZER_H +#define TEST_FUZZTEST_GET_BOOL_PARAMETER_CPP_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetBoolParameterCpp_fuzzer" +#endif diff --git a/test/fuzztest/GetBoolParameterCpp_fuzzer/corpus/init b/test/fuzztest/GetBoolParameterCpp_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetBoolParameterCpp_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetBoolParameterCpp_fuzzer/project.xml b/test/fuzztest/GetBoolParameterCpp_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetBoolParameterCpp_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetBootSlots_fuzzer/GetBootSlots_fuzzer.cpp b/test/fuzztest/GetBootSlots_fuzzer/GetBootSlots_fuzzer.cpp new file mode 100644 index 00000000..a5f2434c --- /dev/null +++ b/test/fuzztest/GetBootSlots_fuzzer/GetBootSlots_fuzzer.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetBootSlots_fuzzer.h" +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzGetBootSlots(const uint8_t* data, size_t size) + { + GetBootSlots(); + return true; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetBootSlots(data, size); + return 0; +} diff --git a/test/fuzztest/GetBootSlots_fuzzer/GetBootSlots_fuzzer.h b/test/fuzztest/GetBootSlots_fuzzer/GetBootSlots_fuzzer.h new file mode 100644 index 00000000..df6c8354 --- /dev/null +++ b/test/fuzztest/GetBootSlots_fuzzer/GetBootSlots_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_BOOT_SLOTS_H +#define TEST_FUZZTEST_GET_BOOT_SLOTS_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetBootSlots_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetBootSlots_fuzzer/corpus/init b/test/fuzztest/GetBootSlots_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetBootSlots_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetBootSlots_fuzzer/project.xml b/test/fuzztest/GetBootSlots_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetBootSlots_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetBootloaderVersion_fuzzer/GetBootloaderVersion_fuzzer.cpp b/test/fuzztest/GetBootloaderVersion_fuzzer/GetBootloaderVersion_fuzzer.cpp new file mode 100644 index 00000000..1af0ab50 --- /dev/null +++ b/test/fuzztest/GetBootloaderVersion_fuzzer/GetBootloaderVersion_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetBootloaderVersion_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetBootloaderVersion(const uint8_t* data, size_t size) + { + bool result = false; + if (GetBootloaderVersion() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetBootloaderVersion(data, size); + return 0; +} diff --git a/test/fuzztest/GetBootloaderVersion_fuzzer/GetBootloaderVersion_fuzzer.h b/test/fuzztest/GetBootloaderVersion_fuzzer/GetBootloaderVersion_fuzzer.h new file mode 100644 index 00000000..f2100c46 --- /dev/null +++ b/test/fuzztest/GetBootloaderVersion_fuzzer/GetBootloaderVersion_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_BOOTLOADER_VERSION_H +#define TEST_FUZZTEST_GET_BOOTLOADER_VERSION_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetBootloaderVersion_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetBootloaderVersion_fuzzer/corpus/init b/test/fuzztest/GetBootloaderVersion_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetBootloaderVersion_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetBootloaderVersion_fuzzer/project.xml b/test/fuzztest/GetBootloaderVersion_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetBootloaderVersion_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetBrand_fuzzer/GetBrand_fuzzer.cpp b/test/fuzztest/GetBrand_fuzzer/GetBrand_fuzzer.cpp new file mode 100644 index 00000000..a4755e9c --- /dev/null +++ b/test/fuzztest/GetBrand_fuzzer/GetBrand_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetBrand_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetBrand(const uint8_t* data, size_t size) + { + bool result = false; + if (GetBrand() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetBrand(data, size); + return 0; +} diff --git a/test/fuzztest/GetBrand_fuzzer/GetBrand_fuzzer.h b/test/fuzztest/GetBrand_fuzzer/GetBrand_fuzzer.h new file mode 100644 index 00000000..31d25eef --- /dev/null +++ b/test/fuzztest/GetBrand_fuzzer/GetBrand_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_BRAND_H +#define TEST_FUZZTEST_GET_BRAND_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetBrand_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetBrand_fuzzer/corpus/init b/test/fuzztest/GetBrand_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetBrand_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetBrand_fuzzer/project.xml b/test/fuzztest/GetBrand_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetBrand_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetBuildHost_fuzzer/GetBuildHost_fuzzer.cpp b/test/fuzztest/GetBuildHost_fuzzer/GetBuildHost_fuzzer.cpp new file mode 100644 index 00000000..a1a34b76 --- /dev/null +++ b/test/fuzztest/GetBuildHost_fuzzer/GetBuildHost_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetBuildHost_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetBuildHost(const uint8_t* data, size_t size) + { + bool result = false; + if (GetBuildHost() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetBuildHost(data, size); + return 0; +} diff --git a/test/fuzztest/GetBuildHost_fuzzer/GetBuildHost_fuzzer.h b/test/fuzztest/GetBuildHost_fuzzer/GetBuildHost_fuzzer.h new file mode 100644 index 00000000..96901492 --- /dev/null +++ b/test/fuzztest/GetBuildHost_fuzzer/GetBuildHost_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_BUILD_HOST_H +#define TEST_FUZZTEST_GET_BUILD_HOST_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetBuildHost_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetBuildHost_fuzzer/corpus/init b/test/fuzztest/GetBuildHost_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetBuildHost_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetBuildHost_fuzzer/project.xml b/test/fuzztest/GetBuildHost_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetBuildHost_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetBuildRootHash_fuzzer/GetBuildRootHash_fuzzer.cpp b/test/fuzztest/GetBuildRootHash_fuzzer/GetBuildRootHash_fuzzer.cpp new file mode 100644 index 00000000..4ae4161d --- /dev/null +++ b/test/fuzztest/GetBuildRootHash_fuzzer/GetBuildRootHash_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetBuildRootHash_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetBuildRootHash(const uint8_t* data, size_t size) + { + bool result = false; + if (GetBuildRootHash() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetBuildRootHash(data, size); + return 0; +} diff --git a/test/fuzztest/GetBuildRootHash_fuzzer/GetBuildRootHash_fuzzer.h b/test/fuzztest/GetBuildRootHash_fuzzer/GetBuildRootHash_fuzzer.h new file mode 100644 index 00000000..743bfc14 --- /dev/null +++ b/test/fuzztest/GetBuildRootHash_fuzzer/GetBuildRootHash_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_BUILD_ROOT_HASH_H +#define TEST_FUZZTEST_GET_BUILD_ROOT_HASH_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetBuildRootHash_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetBuildRootHash_fuzzer/corpus/init b/test/fuzztest/GetBuildRootHash_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetBuildRootHash_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetBuildRootHash_fuzzer/project.xml b/test/fuzztest/GetBuildRootHash_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetBuildRootHash_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetBuildTime_fuzzer/GetBuildTime_fuzzer.cpp b/test/fuzztest/GetBuildTime_fuzzer/GetBuildTime_fuzzer.cpp new file mode 100644 index 00000000..b900ba74 --- /dev/null +++ b/test/fuzztest/GetBuildTime_fuzzer/GetBuildTime_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetBuildTime_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetBuildTime(const uint8_t* data, size_t size) + { + bool result = false; + if (GetBuildTime() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetBuildTime(data, size); + return 0; +} diff --git a/test/fuzztest/GetBuildTime_fuzzer/GetBuildTime_fuzzer.h b/test/fuzztest/GetBuildTime_fuzzer/GetBuildTime_fuzzer.h new file mode 100644 index 00000000..1372a0b2 --- /dev/null +++ b/test/fuzztest/GetBuildTime_fuzzer/GetBuildTime_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_BUILD_TIME_H +#define TEST_FUZZTEST_GET_BUILD_TIME_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetBuildTime_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetBuildTime_fuzzer/corpus/init b/test/fuzztest/GetBuildTime_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetBuildTime_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetBuildTime_fuzzer/project.xml b/test/fuzztest/GetBuildTime_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetBuildTime_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetBuildType_fuzzer/GetBuildType_fuzzer.cpp b/test/fuzztest/GetBuildType_fuzzer/GetBuildType_fuzzer.cpp new file mode 100644 index 00000000..91fb7b9d --- /dev/null +++ b/test/fuzztest/GetBuildType_fuzzer/GetBuildType_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetBuildType_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetBuildType(const uint8_t* data, size_t size) + { + bool result = false; + if (GetBuildType() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetBuildType(data, size); + return 0; +} diff --git a/test/fuzztest/GetBuildType_fuzzer/GetBuildType_fuzzer.h b/test/fuzztest/GetBuildType_fuzzer/GetBuildType_fuzzer.h new file mode 100644 index 00000000..a53be5b0 --- /dev/null +++ b/test/fuzztest/GetBuildType_fuzzer/GetBuildType_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_BUILD_TYPE_H +#define TEST_FUZZTEST_GET_BUILD_TYPE_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetBuildType_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetBuildType_fuzzer/corpus/init b/test/fuzztest/GetBuildType_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetBuildType_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetBuildType_fuzzer/project.xml b/test/fuzztest/GetBuildType_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetBuildType_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetBuildUser_fuzzer/GetBuildUser_fuzzer.cpp b/test/fuzztest/GetBuildUser_fuzzer/GetBuildUser_fuzzer.cpp new file mode 100644 index 00000000..caf875a9 --- /dev/null +++ b/test/fuzztest/GetBuildUser_fuzzer/GetBuildUser_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetBuildUser_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetBuildUser(const uint8_t* data, size_t size) + { + bool result = false; + if (GetBuildUser() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetBuildUser(data, size); + return 0; +} diff --git a/test/fuzztest/GetBuildUser_fuzzer/GetBuildUser_fuzzer.h b/test/fuzztest/GetBuildUser_fuzzer/GetBuildUser_fuzzer.h new file mode 100644 index 00000000..37a75828 --- /dev/null +++ b/test/fuzztest/GetBuildUser_fuzzer/GetBuildUser_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_BUILD_USER_H +#define TEST_FUZZTEST_GET_BUILD_USER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetBuildUser_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetBuildUser_fuzzer/corpus/init b/test/fuzztest/GetBuildUser_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetBuildUser_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetBuildUser_fuzzer/project.xml b/test/fuzztest/GetBuildUser_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetBuildUser_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetBuildVersion_fuzzer/GetBuildVersion_fuzzer.cpp b/test/fuzztest/GetBuildVersion_fuzzer/GetBuildVersion_fuzzer.cpp new file mode 100644 index 00000000..54ae55e0 --- /dev/null +++ b/test/fuzztest/GetBuildVersion_fuzzer/GetBuildVersion_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetBuildVersion_fuzzer.h" +#include +#include "sysversion.h" + +namespace OHOS { + bool FuzzGetBuildVersion(const uint8_t* data, size_t size) + { + bool result = false; + if (!GetBuildVersion()) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetBuildVersion(data, size); + return 0; +} diff --git a/test/fuzztest/GetBuildVersion_fuzzer/GetBuildVersion_fuzzer.h b/test/fuzztest/GetBuildVersion_fuzzer/GetBuildVersion_fuzzer.h new file mode 100644 index 00000000..87de57da --- /dev/null +++ b/test/fuzztest/GetBuildVersion_fuzzer/GetBuildVersion_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_BUILD_VERSION_H +#define TEST_FUZZTEST_GET_BUILD_VERSION_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetBuildVersion_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetBuildVersion_fuzzer/corpus/init b/test/fuzztest/GetBuildVersion_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetBuildVersion_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetBuildVersion_fuzzer/project.xml b/test/fuzztest/GetBuildVersion_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetBuildVersion_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetCurrentSlot_fuzzer/GetCurrentSlot_fuzzer.cpp b/test/fuzztest/GetCurrentSlot_fuzzer/GetCurrentSlot_fuzzer.cpp new file mode 100644 index 00000000..9b7bbce7 --- /dev/null +++ b/test/fuzztest/GetCurrentSlot_fuzzer/GetCurrentSlot_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetCurrentSlot_fuzzer.h" +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzGetCurrentSlot(const uint8_t* data, size_t size) + { + bool result = false; + if (!GetCurrentSlot()) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetCurrentSlot(data, size); + return 0; +} diff --git a/test/fuzztest/GetCurrentSlot_fuzzer/GetCurrentSlot_fuzzer.h b/test/fuzztest/GetCurrentSlot_fuzzer/GetCurrentSlot_fuzzer.h new file mode 100644 index 00000000..4e5ef3a2 --- /dev/null +++ b/test/fuzztest/GetCurrentSlot_fuzzer/GetCurrentSlot_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_CURRENT_SLOTS_H +#define TEST_FUZZTEST_GET_CURRENT_SLOTS_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetCurrentSlot_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetCurrentSlot_fuzzer/corpus/init b/test/fuzztest/GetCurrentSlot_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetCurrentSlot_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetCurrentSlot_fuzzer/project.xml b/test/fuzztest/GetCurrentSlot_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetCurrentSlot_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetDevUdid_fuzzer/GetDevUdid_fuzzer.cpp b/test/fuzztest/GetDevUdid_fuzzer/GetDevUdid_fuzzer.cpp new file mode 100644 index 00000000..596b8269 --- /dev/null +++ b/test/fuzztest/GetDevUdid_fuzzer/GetDevUdid_fuzzer.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetDevUdid_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetDevUdid(const uint8_t* data, size_t size) + { + bool result = false; + char udid[65] = {0}; + int len = sizeof(udid); + if (!GetDevUdid(udid, len)) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetDevUdid(data, size); + return 0; +} diff --git a/test/fuzztest/GetDevUdid_fuzzer/GetDevUdid_fuzzer.h b/test/fuzztest/GetDevUdid_fuzzer/GetDevUdid_fuzzer.h new file mode 100644 index 00000000..3fcf7d9d --- /dev/null +++ b/test/fuzztest/GetDevUdid_fuzzer/GetDevUdid_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_DEV_UDID_FUZZER_H +#define TEST_FUZZTEST_GET_DEV_UDID_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetDevUdid_fuzzer" +#endif diff --git a/test/fuzztest/GetDevUdid_fuzzer/corpus/init b/test/fuzztest/GetDevUdid_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetDevUdid_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetDevUdid_fuzzer/project.xml b/test/fuzztest/GetDevUdid_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetDevUdid_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetDeviceTypeC_fuzzer/GetDeviceTypeC_fuzzer.cpp b/test/fuzztest/GetDeviceTypeC_fuzzer/GetDeviceTypeC_fuzzer.cpp new file mode 100644 index 00000000..54dbd211 --- /dev/null +++ b/test/fuzztest/GetDeviceTypeC_fuzzer/GetDeviceTypeC_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetDeviceTypeC_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetDeviceCType(const uint8_t* data, size_t size) + { + bool result = false; + if (GetDeviceType() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetDeviceCType(data, size); + return 0; +} diff --git a/test/fuzztest/GetDeviceTypeC_fuzzer/GetDeviceTypeC_fuzzer.h b/test/fuzztest/GetDeviceTypeC_fuzzer/GetDeviceTypeC_fuzzer.h new file mode 100644 index 00000000..c4d5cc1a --- /dev/null +++ b/test/fuzztest/GetDeviceTypeC_fuzzer/GetDeviceTypeC_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_DEVICE_TYPE_C_H +#define TEST_FUZZTEST_GET_DEVICE_TYPE_C_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetDeviceTypeC_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetDeviceTypeC_fuzzer/corpus/init b/test/fuzztest/GetDeviceTypeC_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetDeviceTypeC_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetDeviceTypeC_fuzzer/project.xml b/test/fuzztest/GetDeviceTypeC_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetDeviceTypeC_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetDeviceTypeCpp_fuzzer/GetDeviceTypeCpp_fuzzer.cpp b/test/fuzztest/GetDeviceTypeCpp_fuzzer/GetDeviceTypeCpp_fuzzer.cpp new file mode 100644 index 00000000..30e175bc --- /dev/null +++ b/test/fuzztest/GetDeviceTypeCpp_fuzzer/GetDeviceTypeCpp_fuzzer.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetDeviceTypeCpp_fuzzer.h" +#include +#include "parameters.h" + +namespace OHOS { + bool FuzzGetDeviceTypeCpp(const uint8_t* data, size_t size) + { + system::GetDeviceType(); + return true; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetDeviceTypeCpp(data, size); + return 0; +} diff --git a/test/fuzztest/GetDeviceTypeCpp_fuzzer/GetDeviceTypeCpp_fuzzer.h b/test/fuzztest/GetDeviceTypeCpp_fuzzer/GetDeviceTypeCpp_fuzzer.h new file mode 100644 index 00000000..96bbb680 --- /dev/null +++ b/test/fuzztest/GetDeviceTypeCpp_fuzzer/GetDeviceTypeCpp_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_DEVICE_TYPE_CPP_H +#define TEST_FUZZTEST_GET_DEVICE_TYPE_CPP_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetDeviceTypeCpp_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetDeviceTypeCpp_fuzzer/corpus/init b/test/fuzztest/GetDeviceTypeCpp_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetDeviceTypeCpp_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetDeviceTypeCpp_fuzzer/project.xml b/test/fuzztest/GetDeviceTypeCpp_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetDeviceTypeCpp_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetDisplayVersion_fuzzer/GetDisplayVersion_fuzzer.cpp b/test/fuzztest/GetDisplayVersion_fuzzer/GetDisplayVersion_fuzzer.cpp new file mode 100644 index 00000000..5658c793 --- /dev/null +++ b/test/fuzztest/GetDisplayVersion_fuzzer/GetDisplayVersion_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetDisplayVersion_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetDisplayVersion(const uint8_t* data, size_t size) + { + bool result = false; + if (GetDisplayVersion() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetDisplayVersion(data, size); + return 0; +} diff --git a/test/fuzztest/GetDisplayVersion_fuzzer/GetDisplayVersion_fuzzer.h b/test/fuzztest/GetDisplayVersion_fuzzer/GetDisplayVersion_fuzzer.h new file mode 100644 index 00000000..c6301e2c --- /dev/null +++ b/test/fuzztest/GetDisplayVersion_fuzzer/GetDisplayVersion_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_DISPLAY_VERSION_H +#define TEST_FUZZTEST_GET_DISPLAY_VERSION_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetDisplayVersion_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetDisplayVersion_fuzzer/corpus/init b/test/fuzztest/GetDisplayVersion_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetDisplayVersion_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetDisplayVersion_fuzzer/project.xml b/test/fuzztest/GetDisplayVersion_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetDisplayVersion_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetFeatureVersion_fuzzer/GetFeatureVersion_fuzzer.cpp b/test/fuzztest/GetFeatureVersion_fuzzer/GetFeatureVersion_fuzzer.cpp new file mode 100644 index 00000000..ed811ebe --- /dev/null +++ b/test/fuzztest/GetFeatureVersion_fuzzer/GetFeatureVersion_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetFeatureVersion_fuzzer.h" +#include +#include "sysversion.h" + +namespace OHOS { + bool FuzzGetFeatureVersion(const uint8_t* data, size_t size) + { + bool result = false; + if (!GetFeatureVersion()) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetFeatureVersion(data, size); + return 0; +} diff --git a/test/fuzztest/GetFeatureVersion_fuzzer/GetFeatureVersion_fuzzer.h b/test/fuzztest/GetFeatureVersion_fuzzer/GetFeatureVersion_fuzzer.h new file mode 100644 index 00000000..453af1ed --- /dev/null +++ b/test/fuzztest/GetFeatureVersion_fuzzer/GetFeatureVersion_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_FEATURE_VERSION_H +#define TEST_FUZZTEST_GET_FEATURE_VERSION_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetFeatureVersion_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetFeatureVersion_fuzzer/corpus/init b/test/fuzztest/GetFeatureVersion_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetFeatureVersion_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetFeatureVersion_fuzzer/project.xml b/test/fuzztest/GetFeatureVersion_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetFeatureVersion_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetFirstApiVersion_fuzzer/GetFirstApiVersion_fuzzer.cpp b/test/fuzztest/GetFirstApiVersion_fuzzer/GetFirstApiVersion_fuzzer.cpp new file mode 100644 index 00000000..4600cc08 --- /dev/null +++ b/test/fuzztest/GetFirstApiVersion_fuzzer/GetFirstApiVersion_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetFirstApiVersion_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetFirstApiVersion(const uint8_t* data, size_t size) + { + bool result = false; + if (!GetFirstApiVersion()) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetFirstApiVersion(data, size); + return 0; +} diff --git a/test/fuzztest/GetFirstApiVersion_fuzzer/GetFirstApiVersion_fuzzer.h b/test/fuzztest/GetFirstApiVersion_fuzzer/GetFirstApiVersion_fuzzer.h new file mode 100644 index 00000000..b08cd35f --- /dev/null +++ b/test/fuzztest/GetFirstApiVersion_fuzzer/GetFirstApiVersion_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_FIRST_API_VERSION_H +#define TEST_FUZZTEST_GET_FIRST_API_VERSION_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetFirstApiVersion_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetFirstApiVersion_fuzzer/corpus/init b/test/fuzztest/GetFirstApiVersion_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetFirstApiVersion_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetFirstApiVersion_fuzzer/project.xml b/test/fuzztest/GetFirstApiVersion_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetFirstApiVersion_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetHardwareModel_fuzzer/GetHardwareModel_fuzzer.cpp b/test/fuzztest/GetHardwareModel_fuzzer/GetHardwareModel_fuzzer.cpp new file mode 100644 index 00000000..cd53251b --- /dev/null +++ b/test/fuzztest/GetHardwareModel_fuzzer/GetHardwareModel_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetHardwareModel_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetHardwareModel(const uint8_t* data, size_t size) + { + bool result = false; + if (GetHardwareModel() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetHardwareModel(data, size); + return 0; +} diff --git a/test/fuzztest/GetHardwareModel_fuzzer/GetHardwareModel_fuzzer.h b/test/fuzztest/GetHardwareModel_fuzzer/GetHardwareModel_fuzzer.h new file mode 100644 index 00000000..fcdaabe8 --- /dev/null +++ b/test/fuzztest/GetHardwareModel_fuzzer/GetHardwareModel_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_HARDWARE_MODEL_H +#define TEST_FUZZTEST_GET_HARDWARE_MODEL_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetHardwareModel_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetHardwareModel_fuzzer/corpus/init b/test/fuzztest/GetHardwareModel_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetHardwareModel_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetHardwareModel_fuzzer/project.xml b/test/fuzztest/GetHardwareModel_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetHardwareModel_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetHardwareProfile_fuzzer/GetHardwareProfile_fuzzer.cpp b/test/fuzztest/GetHardwareProfile_fuzzer/GetHardwareProfile_fuzzer.cpp new file mode 100644 index 00000000..dc051c80 --- /dev/null +++ b/test/fuzztest/GetHardwareProfile_fuzzer/GetHardwareProfile_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetHardwareProfile_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetHardwareProfile(const uint8_t* data, size_t size) + { + bool result = false; + if (GetHardwareProfile() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetHardwareProfile(data, size); + return 0; +} diff --git a/test/fuzztest/GetHardwareProfile_fuzzer/GetHardwareProfile_fuzzer.h b/test/fuzztest/GetHardwareProfile_fuzzer/GetHardwareProfile_fuzzer.h new file mode 100644 index 00000000..73337ff1 --- /dev/null +++ b/test/fuzztest/GetHardwareProfile_fuzzer/GetHardwareProfile_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_HARDWARE_PROFILE_H +#define TEST_FUZZTEST_GET_HARDWARE_PROFILE_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetHardwareProfile_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetHardwareProfile_fuzzer/corpus/init b/test/fuzztest/GetHardwareProfile_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetHardwareProfile_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetHardwareProfile_fuzzer/project.xml b/test/fuzztest/GetHardwareProfile_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetHardwareProfile_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetIncrementalVersion_fuzzer/GetIncrementalVersion_fuzzer.cpp b/test/fuzztest/GetIncrementalVersion_fuzzer/GetIncrementalVersion_fuzzer.cpp new file mode 100644 index 00000000..db2cc31f --- /dev/null +++ b/test/fuzztest/GetIncrementalVersion_fuzzer/GetIncrementalVersion_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetIncrementalVersion_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetIncrementalVersion(const uint8_t* data, size_t size) + { + bool result = false; + if (GetIncrementalVersion() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetIncrementalVersion(data, size); + return 0; +} diff --git a/test/fuzztest/GetIncrementalVersion_fuzzer/GetIncrementalVersion_fuzzer.h b/test/fuzztest/GetIncrementalVersion_fuzzer/GetIncrementalVersion_fuzzer.h new file mode 100644 index 00000000..7c39ad0a --- /dev/null +++ b/test/fuzztest/GetIncrementalVersion_fuzzer/GetIncrementalVersion_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_INCREMENTAL_VERSION_H +#define TEST_FUZZTEST_GET_INCREMENTAL_VERSION_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetIncrementalVersion_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetIncrementalVersion_fuzzer/corpus/init b/test/fuzztest/GetIncrementalVersion_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetIncrementalVersion_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetIncrementalVersion_fuzzer/project.xml b/test/fuzztest/GetIncrementalVersion_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetIncrementalVersion_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetIntParameterC_fuzzer/GetIntParameterC_fuzzer.cpp b/test/fuzztest/GetIntParameterC_fuzzer/GetIntParameterC_fuzzer.cpp new file mode 100644 index 00000000..b5b97eae --- /dev/null +++ b/test/fuzztest/GetIntParameterC_fuzzer/GetIntParameterC_fuzzer.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetIntParameterC_fuzzer.h" +#include +#include "parameter.h" +#include "init_param.h" + +namespace OHOS { + bool FuzzGetIntParameterC(const uint8_t* data, size_t size) + { + std::string key(reinterpret_cast(data), size); + GetIntParameter(key.c_str(), 1); + return true; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetIntParameterC(data, size); + return 0; +} diff --git a/test/fuzztest/GetIntParameterC_fuzzer/GetIntParameterC_fuzzer.h b/test/fuzztest/GetIntParameterC_fuzzer/GetIntParameterC_fuzzer.h new file mode 100644 index 00000000..6e6e5a39 --- /dev/null +++ b/test/fuzztest/GetIntParameterC_fuzzer/GetIntParameterC_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_INT_PARAMETER_C_FUZZER_H +#define TEST_FUZZTEST_GET_INT_PARAMETER_C_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetIntParameterC_fuzzer" +#endif diff --git a/test/fuzztest/GetIntParameterC_fuzzer/corpus/init b/test/fuzztest/GetIntParameterC_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetIntParameterC_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetIntParameterC_fuzzer/project.xml b/test/fuzztest/GetIntParameterC_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetIntParameterC_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetIntParameterCpp_fuzzer/GetIntParameterCpp_fuzzer.cpp b/test/fuzztest/GetIntParameterCpp_fuzzer/GetIntParameterCpp_fuzzer.cpp new file mode 100644 index 00000000..65ca34af --- /dev/null +++ b/test/fuzztest/GetIntParameterCpp_fuzzer/GetIntParameterCpp_fuzzer.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetIntParameterCpp_fuzzer.h" +#include +#include "param_wrapper.h" + +namespace OHOS { + bool FuzzGetIntParameterCpp(const uint8_t* data, size_t size) + { + std::string key(reinterpret_cast(data), size); + system::GetIntParameter(key, 1); + return true; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetIntParameterCpp(data, size); + return 0; +} diff --git a/test/fuzztest/GetIntParameterCpp_fuzzer/GetIntParameterCpp_fuzzer.h b/test/fuzztest/GetIntParameterCpp_fuzzer/GetIntParameterCpp_fuzzer.h new file mode 100644 index 00000000..3d501415 --- /dev/null +++ b/test/fuzztest/GetIntParameterCpp_fuzzer/GetIntParameterCpp_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_INT_PARAMETER_CPP_FUZZER_H +#define TEST_FUZZTEST_GET_INT_PARAMETER_CPP_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetIntParameterCpp_fuzzer" +#endif diff --git a/test/fuzztest/GetIntParameterCpp_fuzzer/corpus/init b/test/fuzztest/GetIntParameterCpp_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetIntParameterCpp_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetIntParameterCpp_fuzzer/project.xml b/test/fuzztest/GetIntParameterCpp_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetIntParameterCpp_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetMajorVersion_fuzzer/GetMajorVersion_fuzzer.cpp b/test/fuzztest/GetMajorVersion_fuzzer/GetMajorVersion_fuzzer.cpp new file mode 100644 index 00000000..47ad1294 --- /dev/null +++ b/test/fuzztest/GetMajorVersion_fuzzer/GetMajorVersion_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetMajorVersion_fuzzer.h" +#include +#include "sysversion.h" + +namespace OHOS { + bool FuzzGetMajorVersion(const uint8_t* data, size_t size) + { + bool result = false; + if (!GetMajorVersion()) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetMajorVersion(data, size); + return 0; +} diff --git a/test/fuzztest/GetMajorVersion_fuzzer/GetMajorVersion_fuzzer.h b/test/fuzztest/GetMajorVersion_fuzzer/GetMajorVersion_fuzzer.h new file mode 100644 index 00000000..f9efe355 --- /dev/null +++ b/test/fuzztest/GetMajorVersion_fuzzer/GetMajorVersion_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_MAJOR_VERSION_H +#define TEST_FUZZTEST_GET_MAJOR_VERSION_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetMajorVersion_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetMajorVersion_fuzzer/corpus/init b/test/fuzztest/GetMajorVersion_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetMajorVersion_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetMajorVersion_fuzzer/project.xml b/test/fuzztest/GetMajorVersion_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetMajorVersion_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetManufacture_fuzzer/GetManufacture_fuzzer.cpp b/test/fuzztest/GetManufacture_fuzzer/GetManufacture_fuzzer.cpp new file mode 100644 index 00000000..a3cad1ba --- /dev/null +++ b/test/fuzztest/GetManufacture_fuzzer/GetManufacture_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetManufacture_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetManufacture(const uint8_t* data, size_t size) + { + bool result = false; + if (GetManufacture() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetManufacture(data, size); + return 0; +} diff --git a/test/fuzztest/GetManufacture_fuzzer/GetManufacture_fuzzer.h b/test/fuzztest/GetManufacture_fuzzer/GetManufacture_fuzzer.h new file mode 100644 index 00000000..a8fa4f64 --- /dev/null +++ b/test/fuzztest/GetManufacture_fuzzer/GetManufacture_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_MANUFACTURE_H +#define TEST_FUZZTEST_GET_MANUFACTURE_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetManufacture_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetManufacture_fuzzer/corpus/init b/test/fuzztest/GetManufacture_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetManufacture_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetManufacture_fuzzer/project.xml b/test/fuzztest/GetManufacture_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetManufacture_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetMarketName_fuzzer/GetMarketName_fuzzer.cpp b/test/fuzztest/GetMarketName_fuzzer/GetMarketName_fuzzer.cpp new file mode 100644 index 00000000..a2ede647 --- /dev/null +++ b/test/fuzztest/GetMarketName_fuzzer/GetMarketName_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetMarketName_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetMarketName(const uint8_t* data, size_t size) + { + bool result = false; + if (GetMarketName() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetMarketName(data, size); + return 0; +} diff --git a/test/fuzztest/GetMarketName_fuzzer/GetMarketName_fuzzer.h b/test/fuzztest/GetMarketName_fuzzer/GetMarketName_fuzzer.h new file mode 100644 index 00000000..92e53b73 --- /dev/null +++ b/test/fuzztest/GetMarketName_fuzzer/GetMarketName_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_MARKET_NAME_H +#define TEST_FUZZTEST_GET_MARKET_NAME_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetMarketName_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetMarketName_fuzzer/corpus/init b/test/fuzztest/GetMarketName_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetMarketName_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetMarketName_fuzzer/project.xml b/test/fuzztest/GetMarketName_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetMarketName_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetMountStatusForMountPoint_fuzzer/GetMountStatusForMountPoint_fuzzer.cpp b/test/fuzztest/GetMountStatusForMountPoint_fuzzer/GetMountStatusForMountPoint_fuzzer.cpp new file mode 100644 index 00000000..93d783c1 --- /dev/null +++ b/test/fuzztest/GetMountStatusForMountPoint_fuzzer/GetMountStatusForMountPoint_fuzzer.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetMountStatusForMountPoint_fuzzer.h" +#include +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzIsSupportedFilesystem(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + if (GetMountStatusForMountPoint(str.c_str()) != -1) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzIsSupportedFilesystem(data, size); + return 0; +} diff --git a/test/fuzztest/GetMountStatusForMountPoint_fuzzer/GetMountStatusForMountPoint_fuzzer.h b/test/fuzztest/GetMountStatusForMountPoint_fuzzer/GetMountStatusForMountPoint_fuzzer.h new file mode 100644 index 00000000..601ebf4c --- /dev/null +++ b/test/fuzztest/GetMountStatusForMountPoint_fuzzer/GetMountStatusForMountPoint_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_MOUNT_STATUS_FOR_MOUNT_POINT_FUZZER_H +#define TEST_FUZZTEST_GET_MOUNT_STATUS_FOR_MOUNT_POINT_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetMountStatusForMountPoint_fuzzer" +#endif diff --git a/test/fuzztest/GetMountStatusForMountPoint_fuzzer/corpus/init b/test/fuzztest/GetMountStatusForMountPoint_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetMountStatusForMountPoint_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetMountStatusForMountPoint_fuzzer/project.xml b/test/fuzztest/GetMountStatusForMountPoint_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetMountStatusForMountPoint_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetOSFullName_fuzzer/GetOSFullName_fuzzer.cpp b/test/fuzztest/GetOSFullName_fuzzer/GetOSFullName_fuzzer.cpp new file mode 100644 index 00000000..cee546a9 --- /dev/null +++ b/test/fuzztest/GetOSFullName_fuzzer/GetOSFullName_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetOSFullName_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetOSFullName(const uint8_t* data, size_t size) + { + bool result = false; + if (GetOSFullName() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetOSFullName(data, size); + return 0; +} diff --git a/test/fuzztest/GetOSFullName_fuzzer/GetOSFullName_fuzzer.h b/test/fuzztest/GetOSFullName_fuzzer/GetOSFullName_fuzzer.h new file mode 100644 index 00000000..ee4387e6 --- /dev/null +++ b/test/fuzztest/GetOSFullName_fuzzer/GetOSFullName_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_OS_FULL_NAME_H +#define TEST_FUZZTEST_GET_OS_FULL_NAME_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetOSFullName_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetOSFullName_fuzzer/corpus/init b/test/fuzztest/GetOSFullName_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetOSFullName_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetOSFullName_fuzzer/project.xml b/test/fuzztest/GetOSFullName_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetOSFullName_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetOsReleaseType_fuzzer/GetOsReleaseType_fuzzer.cpp b/test/fuzztest/GetOsReleaseType_fuzzer/GetOsReleaseType_fuzzer.cpp new file mode 100644 index 00000000..0222d99d --- /dev/null +++ b/test/fuzztest/GetOsReleaseType_fuzzer/GetOsReleaseType_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetOsReleaseType_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetOsReleaseType(const uint8_t* data, size_t size) + { + bool result = false; + if (GetOsReleaseType() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetOsReleaseType(data, size); + return 0; +} diff --git a/test/fuzztest/GetOsReleaseType_fuzzer/GetOsReleaseType_fuzzer.h b/test/fuzztest/GetOsReleaseType_fuzzer/GetOsReleaseType_fuzzer.h new file mode 100644 index 00000000..caa2c912 --- /dev/null +++ b/test/fuzztest/GetOsReleaseType_fuzzer/GetOsReleaseType_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_OS_RELEASE_TYPE_H +#define TEST_FUZZTEST_GET_OS_RELEASE_TYPE_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetOsReleaseType_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetOsReleaseType_fuzzer/corpus/init b/test/fuzztest/GetOsReleaseType_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetOsReleaseType_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetOsReleaseType_fuzzer/project.xml b/test/fuzztest/GetOsReleaseType_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetOsReleaseType_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/systemgetparameter_fuzzer/systemgetparameter_fuzzer.cpp b/test/fuzztest/GetParameterC_fuzzer/GetParameterC_fuzzer.cpp similarity index 70% rename from test/fuzztest/systemgetparameter_fuzzer/systemgetparameter_fuzzer.cpp rename to test/fuzztest/GetParameterC_fuzzer/GetParameterC_fuzzer.cpp index 4c499993..d1240bef 100644 --- a/test/fuzztest/systemgetparameter_fuzzer/systemgetparameter_fuzzer.cpp +++ b/test/fuzztest/GetParameterC_fuzzer/GetParameterC_fuzzer.cpp @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,19 +13,18 @@ * limitations under the License. */ -#include "systemgetparameter_fuzzer.h" +#include "GetParameterC_fuzzer.h" #include - -#include "init_param.h" +#include "parameter.h" namespace OHOS { - bool FuzzSystemGetParameter(const uint8_t* data, size_t size) + bool FuzzGetParameterC(const uint8_t* data, size_t size) { bool result = false; - char buffer[PARAM_CONST_VALUE_LEN_MAX] = {0}; + char value[PARAM_CONST_VALUE_LEN_MAX] = {0}; uint32_t len = PARAM_CONST_VALUE_LEN_MAX; std::string str(reinterpret_cast(data), size); - if (!SystemGetParameter(str.c_str(), buffer, &len)) { + if (!GetParameter(str.c_str(), nullptr, value, len)) { result = true; } return result; @@ -36,6 +35,6 @@ namespace OHOS { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ - OHOS::FuzzSystemGetParameter(data, size); + OHOS::FuzzGetParameterC(data, size); return 0; } diff --git a/test/fuzztest/GetParameterC_fuzzer/GetParameterC_fuzzer.h b/test/fuzztest/GetParameterC_fuzzer/GetParameterC_fuzzer.h new file mode 100644 index 00000000..5ecce783 --- /dev/null +++ b/test/fuzztest/GetParameterC_fuzzer/GetParameterC_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_PARAMETER_C_FUZZER_H +#define TEST_FUZZTEST_GET_PARAMETER_C_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetParameterC_fuzzer" +#endif diff --git a/test/fuzztest/GetParameterC_fuzzer/corpus/init b/test/fuzztest/GetParameterC_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetParameterC_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetParameterC_fuzzer/project.xml b/test/fuzztest/GetParameterC_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetParameterC_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/systemgetparametercommitid_fuzzer/systemgetparametercommitid_fuzzer.cpp b/test/fuzztest/GetParameterCommitId_fuzzer/GetParameterCommitId_fuzzer.cpp similarity index 73% rename from test/fuzztest/systemgetparametercommitid_fuzzer/systemgetparametercommitid_fuzzer.cpp rename to test/fuzztest/GetParameterCommitId_fuzzer/GetParameterCommitId_fuzzer.cpp index ec84a934..b06e368e 100644 --- a/test/fuzztest/systemgetparametercommitid_fuzzer/systemgetparametercommitid_fuzzer.cpp +++ b/test/fuzztest/GetParameterCommitId_fuzzer/GetParameterCommitId_fuzzer.cpp @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,20 +13,20 @@ * limitations under the License. */ -#include "systemgetparametercommitid_fuzzer.h" +#include "GetParameterCommitId_fuzzer.h" #include +#include "parameter.h" #include "init_param.h" #include "fuzz_utils.h" namespace OHOS { - bool FuzzSystemGetParameterCommitId(const uint8_t* data, size_t size) + bool FuzzGetParameterCommitId(const uint8_t* data, size_t size) { bool result = false; - uint32_t commitId = 0; char *rest = nullptr; std::string str(reinterpret_cast(data), size); ParamHandle handle = (ParamHandle)strtoul(str.c_str(), &rest, BASE); - if (!SystemGetParameterCommitId(handle, &commitId)) { + if (!GetParameterCommitId(handle)) { result = true; } return result; @@ -37,6 +37,6 @@ namespace OHOS { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ - OHOS::FuzzSystemGetParameterCommitId(data, size); + OHOS::FuzzGetParameterCommitId(data, size); return 0; } diff --git a/test/fuzztest/GetParameterCommitId_fuzzer/GetParameterCommitId_fuzzer.h b/test/fuzztest/GetParameterCommitId_fuzzer/GetParameterCommitId_fuzzer.h new file mode 100644 index 00000000..b8402bbd --- /dev/null +++ b/test/fuzztest/GetParameterCommitId_fuzzer/GetParameterCommitId_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GETPARAMETERCOMMITID_FUZZER_H +#define TEST_FUZZTEST_GETPARAMETERCOMMITID_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetParameterCommitId_fuzzer_fuzzer" +#endif diff --git a/test/fuzztest/GetParameterCommitId_fuzzer/corpus/init b/test/fuzztest/GetParameterCommitId_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetParameterCommitId_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetParameterCommitId_fuzzer/project.xml b/test/fuzztest/GetParameterCommitId_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetParameterCommitId_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetParameterCpp_fuzzer/GetParameterCpp_fuzzer.cpp b/test/fuzztest/GetParameterCpp_fuzzer/GetParameterCpp_fuzzer.cpp new file mode 100644 index 00000000..4b851376 --- /dev/null +++ b/test/fuzztest/GetParameterCpp_fuzzer/GetParameterCpp_fuzzer.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetParameterCpp_fuzzer.h" +#include +#include "parameters.h" + +namespace OHOS { + bool FuzzGetParameter(const uint8_t* data, size_t size) + { + bool result = false; + const std::string def = ""; + std::string key(reinterpret_cast(data), size); + if (system::GetParameter(key, def) != def) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetParameter(data, size); + return 0; +} diff --git a/test/fuzztest/GetParameterCpp_fuzzer/GetParameterCpp_fuzzer.h b/test/fuzztest/GetParameterCpp_fuzzer/GetParameterCpp_fuzzer.h new file mode 100644 index 00000000..96f1c25a --- /dev/null +++ b/test/fuzztest/GetParameterCpp_fuzzer/GetParameterCpp_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_PARAMETER_CPP_FUZZER_H +#define TEST_FUZZTEST_GET_PARAMETER_CPP_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetParameterCpp_fuzzer" +#endif diff --git a/test/fuzztest/GetParameterCpp_fuzzer/corpus/init b/test/fuzztest/GetParameterCpp_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetParameterCpp_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetParameterCpp_fuzzer/project.xml b/test/fuzztest/GetParameterCpp_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetParameterCpp_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/systemgetparametername_fuzzer/systemgetparametername_fuzzer.cpp b/test/fuzztest/GetParameterName_fuzzer/GetParameterName_fuzzer.cpp similarity index 75% rename from test/fuzztest/systemgetparametername_fuzzer/systemgetparametername_fuzzer.cpp rename to test/fuzztest/GetParameterName_fuzzer/GetParameterName_fuzzer.cpp index 75d4cdf9..36a7f119 100644 --- a/test/fuzztest/systemgetparametername_fuzzer/systemgetparametername_fuzzer.cpp +++ b/test/fuzztest/GetParameterName_fuzzer/GetParameterName_fuzzer.cpp @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,20 +13,21 @@ * limitations under the License. */ -#include "systemgetparametername_fuzzer.h" +#include "GetParameterName_fuzzer.h" #include +#include "parameter.h" #include "init_param.h" #include "fuzz_utils.h" namespace OHOS { - bool FuzzSystemGetParameterName(const uint8_t* data, size_t size) + bool FuzzGetParameterName(const uint8_t* data, size_t size) { bool result = false; char buffer[PARAM_NAME_LEN_MAX] = {0}; char *rest = nullptr; std::string str(reinterpret_cast(data), size); ParamHandle handle = (ParamHandle)strtoul(str.c_str(), &rest, BASE); - if (!SystemGetParameterName(handle, buffer, PARAM_NAME_LEN_MAX)) { + if (!GetParameterName(handle, buffer, PARAM_NAME_LEN_MAX)) { result = true; } return result; @@ -37,6 +38,6 @@ namespace OHOS { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ - OHOS::FuzzSystemGetParameterName(data, size); + OHOS::FuzzGetParameterName(data, size); return 0; } diff --git a/test/fuzztest/GetParameterName_fuzzer/GetParameterName_fuzzer.h b/test/fuzztest/GetParameterName_fuzzer/GetParameterName_fuzzer.h new file mode 100644 index 00000000..b375cf4e --- /dev/null +++ b/test/fuzztest/GetParameterName_fuzzer/GetParameterName_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GETPARAMETERNAME_FUZZER_H +#define TEST_FUZZTEST_GETPARAMETERNAME_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetParameterName_fuzzer" +#endif diff --git a/test/fuzztest/GetParameterName_fuzzer/corpus/init b/test/fuzztest/GetParameterName_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetParameterName_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetParameterName_fuzzer/project.xml b/test/fuzztest/GetParameterName_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetParameterName_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/systemgetparametervalue_fuzzer/systemgetparametervalue_fuzzer.cpp b/test/fuzztest/GetParameterValue_fuzzer/GetParameterValue_fuzzer.cpp similarity index 77% rename from test/fuzztest/systemgetparametervalue_fuzzer/systemgetparametervalue_fuzzer.cpp rename to test/fuzztest/GetParameterValue_fuzzer/GetParameterValue_fuzzer.cpp index 43438a04..2bd832c8 100644 --- a/test/fuzztest/systemgetparametervalue_fuzzer/systemgetparametervalue_fuzzer.cpp +++ b/test/fuzztest/GetParameterValue_fuzzer/GetParameterValue_fuzzer.cpp @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,13 +13,14 @@ * limitations under the License. */ -#include "systemgetparametervalue_fuzzer.h" +#include "GetParameterValue_fuzzer.h" #include +#include "parameter.h" #include "init_param.h" #include "fuzz_utils.h" namespace OHOS { - bool FuzzSystemGetParameterValue(const uint8_t* data, size_t size) + bool FuzzGetParameterValue(const uint8_t* data, size_t size) { bool result = false; char buffer[PARAM_CONST_VALUE_LEN_MAX] = {0}; @@ -27,7 +28,7 @@ namespace OHOS { char *rest = nullptr; std::string str(reinterpret_cast(data), size); ParamHandle handle = (ParamHandle)strtoul(str.c_str(), &rest, BASE); - if (!SystemGetParameterValue(handle, buffer, &len)) { + if (!GetParameterValue(handle, buffer, len)) { result = true; } return result; @@ -38,6 +39,6 @@ namespace OHOS { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ - OHOS::FuzzSystemGetParameterValue(data, size); + OHOS::FuzzGetParameterValue(data, size); return 0; } diff --git a/test/fuzztest/GetParameterValue_fuzzer/GetParameterValue_fuzzer.h b/test/fuzztest/GetParameterValue_fuzzer/GetParameterValue_fuzzer.h new file mode 100644 index 00000000..6baae375 --- /dev/null +++ b/test/fuzztest/GetParameterValue_fuzzer/GetParameterValue_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GETPARAMETERVALUE_FUZZER_H +#define TEST_FUZZTEST_GETPARAMETERVALUE_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetParameterValue_fuzzer" +#endif diff --git a/test/fuzztest/GetParameterValue_fuzzer/corpus/init b/test/fuzztest/GetParameterValue_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetParameterValue_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetParameterValue_fuzzer/project.xml b/test/fuzztest/GetParameterValue_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetParameterValue_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetProductModel_fuzzer/GetProductModel_fuzzer.cpp b/test/fuzztest/GetProductModel_fuzzer/GetProductModel_fuzzer.cpp new file mode 100644 index 00000000..b7d55ff2 --- /dev/null +++ b/test/fuzztest/GetProductModel_fuzzer/GetProductModel_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetProductModel_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetProductModel(const uint8_t* data, size_t size) + { + bool result = false; + if (GetProductModel() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetProductModel(data, size); + return 0; +} diff --git a/test/fuzztest/GetProductModel_fuzzer/GetProductModel_fuzzer.h b/test/fuzztest/GetProductModel_fuzzer/GetProductModel_fuzzer.h new file mode 100644 index 00000000..6a910707 --- /dev/null +++ b/test/fuzztest/GetProductModel_fuzzer/GetProductModel_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_PRODUCT_MODULE_H +#define TEST_FUZZTEST_GET_PRODUCT_MODULE_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetProductModel_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetProductModel_fuzzer/corpus/init b/test/fuzztest/GetProductModel_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetProductModel_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetProductModel_fuzzer/project.xml b/test/fuzztest/GetProductModel_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetProductModel_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetProductSeries_fuzzer/GetProductSeries_fuzzer.cpp b/test/fuzztest/GetProductSeries_fuzzer/GetProductSeries_fuzzer.cpp new file mode 100644 index 00000000..a34128bc --- /dev/null +++ b/test/fuzztest/GetProductSeries_fuzzer/GetProductSeries_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetProductSeries_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetProductSeries(const uint8_t* data, size_t size) + { + bool result = false; + if (GetProductSeries() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetProductSeries(data, size); + return 0; +} diff --git a/test/fuzztest/GetProductSeries_fuzzer/GetProductSeries_fuzzer.h b/test/fuzztest/GetProductSeries_fuzzer/GetProductSeries_fuzzer.h new file mode 100644 index 00000000..bcc4c103 --- /dev/null +++ b/test/fuzztest/GetProductSeries_fuzzer/GetProductSeries_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_PRODUCT_SERIES_H +#define TEST_FUZZTEST_GET_PRODUCT_SERIES_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetProductSeries_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetProductSeries_fuzzer/corpus/init b/test/fuzztest/GetProductSeries_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetProductSeries_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetProductSeries_fuzzer/project.xml b/test/fuzztest/GetProductSeries_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetProductSeries_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetSdkApiVersion_fuzzer/GetSdkApiVersion_fuzzer.cpp b/test/fuzztest/GetSdkApiVersion_fuzzer/GetSdkApiVersion_fuzzer.cpp new file mode 100644 index 00000000..259f2603 --- /dev/null +++ b/test/fuzztest/GetSdkApiVersion_fuzzer/GetSdkApiVersion_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetSdkApiVersion_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetSdkApiVersion(const uint8_t* data, size_t size) + { + bool result = false; + if (!GetSdkApiVersion()) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetSdkApiVersion(data, size); + return 0; +} diff --git a/test/fuzztest/GetSdkApiVersion_fuzzer/GetSdkApiVersion_fuzzer.h b/test/fuzztest/GetSdkApiVersion_fuzzer/GetSdkApiVersion_fuzzer.h new file mode 100644 index 00000000..8133a648 --- /dev/null +++ b/test/fuzztest/GetSdkApiVersion_fuzzer/GetSdkApiVersion_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_SDK_API_VERSION_H +#define TEST_FUZZTEST_GET_SDK_API_VERSION_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetSdkApiVersion_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetSdkApiVersion_fuzzer/corpus/init b/test/fuzztest/GetSdkApiVersion_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetSdkApiVersion_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetSdkApiVersion_fuzzer/project.xml b/test/fuzztest/GetSdkApiVersion_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetSdkApiVersion_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetSecurityPatchTag_fuzzer/GetSecurityPatchTag_fuzzer.cpp b/test/fuzztest/GetSecurityPatchTag_fuzzer/GetSecurityPatchTag_fuzzer.cpp new file mode 100644 index 00000000..c1c22730 --- /dev/null +++ b/test/fuzztest/GetSecurityPatchTag_fuzzer/GetSecurityPatchTag_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetSecurityPatchTag_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetSecurityPatchTag(const uint8_t* data, size_t size) + { + bool result = false; + if (GetSecurityPatchTag() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetSecurityPatchTag(data, size); + return 0; +} diff --git a/test/fuzztest/GetSecurityPatchTag_fuzzer/GetSecurityPatchTag_fuzzer.h b/test/fuzztest/GetSecurityPatchTag_fuzzer/GetSecurityPatchTag_fuzzer.h new file mode 100644 index 00000000..adc6fda5 --- /dev/null +++ b/test/fuzztest/GetSecurityPatchTag_fuzzer/GetSecurityPatchTag_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_SECURITY_PATCH_TAG_H +#define TEST_FUZZTEST_GET_SECURITY_PATCH_TAG_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetSecurityPatchTag_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetSecurityPatchTag_fuzzer/corpus/init b/test/fuzztest/GetSecurityPatchTag_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetSecurityPatchTag_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetSecurityPatchTag_fuzzer/project.xml b/test/fuzztest/GetSecurityPatchTag_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetSecurityPatchTag_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetSeniorVersion_fuzzer/GetSeniorVersion_fuzzer.cpp b/test/fuzztest/GetSeniorVersion_fuzzer/GetSeniorVersion_fuzzer.cpp new file mode 100644 index 00000000..750655ee --- /dev/null +++ b/test/fuzztest/GetSeniorVersion_fuzzer/GetSeniorVersion_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetSeniorVersion_fuzzer.h" +#include +#include "sysversion.h" + +namespace OHOS { + bool FuzzGetSeniorVersion(const uint8_t* data, size_t size) + { + bool result = false; + if (!GetSeniorVersion()) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetSeniorVersion(data, size); + return 0; +} diff --git a/test/fuzztest/GetSeniorVersion_fuzzer/GetSeniorVersion_fuzzer.h b/test/fuzztest/GetSeniorVersion_fuzzer/GetSeniorVersion_fuzzer.h new file mode 100644 index 00000000..daee435e --- /dev/null +++ b/test/fuzztest/GetSeniorVersion_fuzzer/GetSeniorVersion_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_SENIOR_VERSION_H +#define TEST_FUZZTEST_GET_SENIOR_VERSION_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetSeniorVersion_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetSeniorVersion_fuzzer/corpus/init b/test/fuzztest/GetSeniorVersion_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetSeniorVersion_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetSeniorVersion_fuzzer/project.xml b/test/fuzztest/GetSeniorVersion_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetSeniorVersion_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetSerial_fuzzer/GetSerial_fuzzer.cpp b/test/fuzztest/GetSerial_fuzzer/GetSerial_fuzzer.cpp new file mode 100644 index 00000000..4b9be560 --- /dev/null +++ b/test/fuzztest/GetSerial_fuzzer/GetSerial_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetSerial_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetSerial(const uint8_t* data, size_t size) + { + bool result = false; + if (GetSerial() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetSerial(data, size); + return 0; +} diff --git a/test/fuzztest/GetSerial_fuzzer/GetSerial_fuzzer.h b/test/fuzztest/GetSerial_fuzzer/GetSerial_fuzzer.h new file mode 100644 index 00000000..dffbb768 --- /dev/null +++ b/test/fuzztest/GetSerial_fuzzer/GetSerial_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_SERIAL_H +#define TEST_FUZZTEST_GET_SERIAL_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetSerial_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetSerial_fuzzer/corpus/init b/test/fuzztest/GetSerial_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetSerial_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetSerial_fuzzer/project.xml b/test/fuzztest/GetSerial_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetSerial_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetSoftwareModel_fuzzer/GetSoftwareModel_fuzzer.cpp b/test/fuzztest/GetSoftwareModel_fuzzer/GetSoftwareModel_fuzzer.cpp new file mode 100644 index 00000000..f2c733ef --- /dev/null +++ b/test/fuzztest/GetSoftwareModel_fuzzer/GetSoftwareModel_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetSoftwareModel_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetSoftwareModel(const uint8_t* data, size_t size) + { + bool result = false; + if (GetSoftwareModel() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetSoftwareModel(data, size); + return 0; +} diff --git a/test/fuzztest/GetSoftwareModel_fuzzer/GetSoftwareModel_fuzzer.h b/test/fuzztest/GetSoftwareModel_fuzzer/GetSoftwareModel_fuzzer.h new file mode 100644 index 00000000..40d39374 --- /dev/null +++ b/test/fuzztest/GetSoftwareModel_fuzzer/GetSoftwareModel_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_SOFTWARE_MODULE_H +#define TEST_FUZZTEST_GET_SOFTWARE_MODULE_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetSoftwareModel_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetSoftwareModel_fuzzer/corpus/init b/test/fuzztest/GetSoftwareModel_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetSoftwareModel_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetSoftwareModel_fuzzer/project.xml b/test/fuzztest/GetSoftwareModel_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetSoftwareModel_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetStringParameter_fuzzer/GetStringParameter_fuzzer.cpp b/test/fuzztest/GetStringParameter_fuzzer/GetStringParameter_fuzzer.cpp new file mode 100644 index 00000000..8c540010 --- /dev/null +++ b/test/fuzztest/GetStringParameter_fuzzer/GetStringParameter_fuzzer.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetStringParameter_fuzzer.h" +#include +#include "param_wrapper.h" + +namespace OHOS { + bool FuzzGetStringParameter(const uint8_t* data, size_t size) + { + bool result = false; + std::string value = ""; + std::string key(reinterpret_cast(data), size); + if (!system::GetStringParameter(key, value, "")) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetStringParameter(data, size); + return 0; +} diff --git a/test/fuzztest/systemgetparameter_fuzzer/systemgetparameter_fuzzer.h b/test/fuzztest/GetStringParameter_fuzzer/GetStringParameter_fuzzer.h similarity index 87% rename from test/fuzztest/systemgetparameter_fuzzer/systemgetparameter_fuzzer.h rename to test/fuzztest/GetStringParameter_fuzzer/GetStringParameter_fuzzer.h index f86f369a..4562a274 100644 --- a/test/fuzztest/systemgetparameter_fuzzer/systemgetparameter_fuzzer.h +++ b/test/fuzztest/GetStringParameter_fuzzer/GetStringParameter_fuzzer.h @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/test/fuzztest/GetStringParameter_fuzzer/corpus/init b/test/fuzztest/GetStringParameter_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetStringParameter_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetStringParameter_fuzzer/project.xml b/test/fuzztest/GetStringParameter_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetStringParameter_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetSystemCommitId_fuzzer/GetSystemCommitId_fuzzer.cpp b/test/fuzztest/GetSystemCommitId_fuzzer/GetSystemCommitId_fuzzer.cpp new file mode 100644 index 00000000..54632392 --- /dev/null +++ b/test/fuzztest/GetSystemCommitId_fuzzer/GetSystemCommitId_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetSystemCommitId_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetSystemCommitId(const uint8_t* data, size_t size) + { + bool result = false; + if (!GetSystemCommitId()) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetSystemCommitId(data, size); + return 0; +} diff --git a/test/fuzztest/GetSystemCommitId_fuzzer/GetSystemCommitId_fuzzer.h b/test/fuzztest/GetSystemCommitId_fuzzer/GetSystemCommitId_fuzzer.h new file mode 100644 index 00000000..f1f57efe --- /dev/null +++ b/test/fuzztest/GetSystemCommitId_fuzzer/GetSystemCommitId_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_SYSTEM_COMMITID_H +#define TEST_FUZZTEST_GET_SYSTEM_COMMITID_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetSystemCommitId_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetSystemCommitId_fuzzer/corpus/init b/test/fuzztest/GetSystemCommitId_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetSystemCommitId_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetSystemCommitId_fuzzer/project.xml b/test/fuzztest/GetSystemCommitId_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetSystemCommitId_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetUintParameterC_fuzzer/GetUintParameterC_fuzzer.cpp b/test/fuzztest/GetUintParameterC_fuzzer/GetUintParameterC_fuzzer.cpp new file mode 100644 index 00000000..f5a26431 --- /dev/null +++ b/test/fuzztest/GetUintParameterC_fuzzer/GetUintParameterC_fuzzer.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetUintParameterC_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetUintParameterC(const uint8_t* data, size_t size) + { + std::string key(reinterpret_cast(data), size); + GetUintParameter(key.c_str(), 1); + return true; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetUintParameterC(data, size); + return 0; +} diff --git a/test/fuzztest/GetUintParameterC_fuzzer/GetUintParameterC_fuzzer.h b/test/fuzztest/GetUintParameterC_fuzzer/GetUintParameterC_fuzzer.h new file mode 100644 index 00000000..2d329b0e --- /dev/null +++ b/test/fuzztest/GetUintParameterC_fuzzer/GetUintParameterC_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_UINT_PARAMETER_C_FUZZER_H +#define TEST_FUZZTEST_GET_UINT_PARAMETER_C_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetUintParameterC_fuzzer" +#endif diff --git a/test/fuzztest/GetUintParameterC_fuzzer/corpus/init b/test/fuzztest/GetUintParameterC_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetUintParameterC_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetUintParameterC_fuzzer/project.xml b/test/fuzztest/GetUintParameterC_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetUintParameterC_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/GetVersionId_fuzzer/GetVersionId_fuzzer.cpp b/test/fuzztest/GetVersionId_fuzzer/GetVersionId_fuzzer.cpp new file mode 100644 index 00000000..8fa4e3a1 --- /dev/null +++ b/test/fuzztest/GetVersionId_fuzzer/GetVersionId_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GetVersionId_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzGetVersionId(const uint8_t* data, size_t size) + { + bool result = false; + if (GetVersionId() != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzGetVersionId(data, size); + return 0; +} diff --git a/test/fuzztest/GetVersionId_fuzzer/GetVersionId_fuzzer.h b/test/fuzztest/GetVersionId_fuzzer/GetVersionId_fuzzer.h new file mode 100644 index 00000000..c504b3a5 --- /dev/null +++ b/test/fuzztest/GetVersionId_fuzzer/GetVersionId_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_GET_VERSION_ID_H +#define TEST_FUZZTEST_GET_VERSION_ID_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "GetVersionId_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/GetVersionId_fuzzer/corpus/init b/test/fuzztest/GetVersionId_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/GetVersionId_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/GetVersionId_fuzzer/project.xml b/test/fuzztest/GetVersionId_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/GetVersionId_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/systemsetparameter_fuzzer/systemsetparameter_fuzzer.cpp b/test/fuzztest/HasSystemCapability_fuzzer/HasSystemCapability_fuzzer.cpp similarity index 72% rename from test/fuzztest/systemsetparameter_fuzzer/systemsetparameter_fuzzer.cpp rename to test/fuzztest/HasSystemCapability_fuzzer/HasSystemCapability_fuzzer.cpp index 3e71f6dd..7fd3294f 100644 --- a/test/fuzztest/systemsetparameter_fuzzer/systemsetparameter_fuzzer.cpp +++ b/test/fuzztest/HasSystemCapability_fuzzer/HasSystemCapability_fuzzer.cpp @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,16 +13,16 @@ * limitations under the License. */ -#include "systemsetparameter_fuzzer.h" +#include "HasSystemCapability_fuzzer.h" #include -#include "init_param.h" +#include "systemcapability.h" namespace OHOS { - bool FuzzSystemSetParameter(const uint8_t* data, size_t size) + bool FuzzHasSystemCapability(const uint8_t* data, size_t size) { bool result = false; std::string str(reinterpret_cast(data), size); - if (!SystemSetParameter(str.c_str(), str.c_str())) { + if (!HasSystemCapability(str.c_str())) { result = true; } return result; @@ -33,6 +33,6 @@ namespace OHOS { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ - OHOS::FuzzSystemSetParameter(data, size); + OHOS::FuzzHasSystemCapability(data, size); return 0; } diff --git a/test/fuzztest/HasSystemCapability_fuzzer/HasSystemCapability_fuzzer.h b/test/fuzztest/HasSystemCapability_fuzzer/HasSystemCapability_fuzzer.h new file mode 100644 index 00000000..f3c59e88 --- /dev/null +++ b/test/fuzztest/HasSystemCapability_fuzzer/HasSystemCapability_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_HAS_SYSTEM_CAPABILITY_FUZZER_H +#define TEST_FUZZTEST_HAS_SYSTEM_CAPABILITY_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "HasSystemCapability_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/HasSystemCapability_fuzzer/corpus/init b/test/fuzztest/HasSystemCapability_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/HasSystemCapability_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/HasSystemCapability_fuzzer/project.xml b/test/fuzztest/HasSystemCapability_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/HasSystemCapability_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/HookMgrAddEx_fuzzer/HookMgrAddEx_fuzzer.cpp b/test/fuzztest/HookMgrAddEx_fuzzer/HookMgrAddEx_fuzzer.cpp new file mode 100644 index 00000000..86e2790e --- /dev/null +++ b/test/fuzztest/HookMgrAddEx_fuzzer/HookMgrAddEx_fuzzer.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "HookMgrAddEx_fuzzer.h" +#include +#include "hookmgr.h" + +namespace OHOS { + bool FuzzHookMgrAddEx(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + HOOK_MGR *hookMgr = HookMgrCreate(str.c_str()); + + if (!HookMgrAddEx(hookMgr, nullptr)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzHookMgrAddEx(data, size); + return 0; +} \ No newline at end of file diff --git a/test/fuzztest/HookMgrAddEx_fuzzer/HookMgrAddEx_fuzzer.h b/test/fuzztest/HookMgrAddEx_fuzzer/HookMgrAddEx_fuzzer.h new file mode 100644 index 00000000..83e87d45 --- /dev/null +++ b/test/fuzztest/HookMgrAddEx_fuzzer/HookMgrAddEx_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_HOOK_MGR_ADD_EX_FUZZER_H +#define TEST_FUZZTEST_HOOK_MGR_ADD_EX_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "HookMgrAddEx_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/HookMgrAddEx_fuzzer/corpus/init b/test/fuzztest/HookMgrAddEx_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/HookMgrAddEx_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/HookMgrAddEx_fuzzer/project.xml b/test/fuzztest/HookMgrAddEx_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/HookMgrAddEx_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/HookMgrAdd_fuzzer/HookMgrAdd_fuzzer.cpp b/test/fuzztest/HookMgrAdd_fuzzer/HookMgrAdd_fuzzer.cpp new file mode 100644 index 00000000..a8cbdb42 --- /dev/null +++ b/test/fuzztest/HookMgrAdd_fuzzer/HookMgrAdd_fuzzer.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "HookMgrAdd_fuzzer.h" +#include +#include "hookmgr.h" + +static int TestHook(const HOOK_INFO *hookInfo, void *executionContext) +{ + printf("Test HookMgrAdd\n"); + return 0; +} + +namespace OHOS { + bool FuzzHookMgrAdd(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + HOOK_MGR *hookMgr = HookMgrCreate(str.c_str()); + + if (!HookMgrAdd(hookMgr, 0, 0, TestHook)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzHookMgrAdd(data, size); + return 0; +} \ No newline at end of file diff --git a/test/fuzztest/HookMgrAdd_fuzzer/HookMgrAdd_fuzzer.h b/test/fuzztest/HookMgrAdd_fuzzer/HookMgrAdd_fuzzer.h new file mode 100644 index 00000000..fda9e065 --- /dev/null +++ b/test/fuzztest/HookMgrAdd_fuzzer/HookMgrAdd_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_HOOK_MGR_ADD_FUZZER_H +#define TEST_FUZZTEST_HOOK_MGR_ADD_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "HookMgrAdd_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/HookMgrAdd_fuzzer/corpus/init b/test/fuzztest/HookMgrAdd_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/HookMgrAdd_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/HookMgrAdd_fuzzer/project.xml b/test/fuzztest/HookMgrAdd_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/HookMgrAdd_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/HookMgrCreate_fuzzer/HookMgrCreate_fuzzer.cpp b/test/fuzztest/HookMgrCreate_fuzzer/HookMgrCreate_fuzzer.cpp new file mode 100644 index 00000000..8f0f364d --- /dev/null +++ b/test/fuzztest/HookMgrCreate_fuzzer/HookMgrCreate_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "HookMgrCreate_fuzzer.h" +#include +#include "hookmgr.h" + +namespace OHOS { + bool FuzzHookMgrCreate(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + if (HookMgrCreate(str.c_str()) != nullptr) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzHookMgrCreate(data, size); + return 0; +} diff --git a/test/fuzztest/HookMgrCreate_fuzzer/HookMgrCreate_fuzzer.h b/test/fuzztest/HookMgrCreate_fuzzer/HookMgrCreate_fuzzer.h new file mode 100644 index 00000000..563eb5e5 --- /dev/null +++ b/test/fuzztest/HookMgrCreate_fuzzer/HookMgrCreate_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_HOOK_MGR_CREATE_FUZZER_H +#define TEST_FUZZTEST_HOOK_MGR_CREATE_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "HookMgrCreate_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/HookMgrCreate_fuzzer/corpus/init b/test/fuzztest/HookMgrCreate_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/HookMgrCreate_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/HookMgrCreate_fuzzer/project.xml b/test/fuzztest/HookMgrCreate_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/HookMgrCreate_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/HookMgrDel_fuzzer/HookMgrDel_fuzzer.cpp b/test/fuzztest/HookMgrDel_fuzzer/HookMgrDel_fuzzer.cpp new file mode 100644 index 00000000..4b99e2f6 --- /dev/null +++ b/test/fuzztest/HookMgrDel_fuzzer/HookMgrDel_fuzzer.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "HookMgrDel_fuzzer.h" +#include +#include "hookmgr.h" + +static int TestHook(const HOOK_INFO *hookInfo, void *executionContext) +{ + printf("Test HookMgrAdd\n"); + return 0; +} + +namespace OHOS { + bool FuzzHookMgrDel(const uint8_t* data, size_t size) + { + std::string str(reinterpret_cast(data), size); + HOOK_MGR *hookMgr = HookMgrCreate(str.c_str()); + HookMgrDel(hookMgr, 0, TestHook); + return true; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzHookMgrDel(data, size); + return 0; +} \ No newline at end of file diff --git a/test/fuzztest/HookMgrDel_fuzzer/HookMgrDel_fuzzer.h b/test/fuzztest/HookMgrDel_fuzzer/HookMgrDel_fuzzer.h new file mode 100644 index 00000000..c808f988 --- /dev/null +++ b/test/fuzztest/HookMgrDel_fuzzer/HookMgrDel_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_HOOK_MGR_DEL_FUZZER_H +#define TEST_FUZZTEST_HOOK_MGR_DEL_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "HookMgrDel_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/HookMgrDel_fuzzer/corpus/init b/test/fuzztest/HookMgrDel_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/HookMgrDel_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/HookMgrDel_fuzzer/project.xml b/test/fuzztest/HookMgrDel_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/HookMgrDel_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/HookMgrDestroy_fuzzer/HookMgrDestroy_fuzzer.cpp b/test/fuzztest/HookMgrDestroy_fuzzer/HookMgrDestroy_fuzzer.cpp new file mode 100644 index 00000000..dc10d878 --- /dev/null +++ b/test/fuzztest/HookMgrDestroy_fuzzer/HookMgrDestroy_fuzzer.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "HookMgrDestroy_fuzzer.h" +#include +#include "hookmgr.h" + +namespace OHOS { + bool FuzzHookMgrDestroy(const uint8_t* data, size_t size) + { + std::string str(reinterpret_cast(data), size); + HOOK_MGR *hookMgr = HookMgrCreate(str.c_str()); + HookMgrDestroy(hookMgr); + return true; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzHookMgrDestroy(data, size); + return 0; +} diff --git a/test/fuzztest/HookMgrDestroy_fuzzer/HookMgrDestroy_fuzzer.h b/test/fuzztest/HookMgrDestroy_fuzzer/HookMgrDestroy_fuzzer.h new file mode 100644 index 00000000..05603946 --- /dev/null +++ b/test/fuzztest/HookMgrDestroy_fuzzer/HookMgrDestroy_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_HOOK_MGR_DESTROY_FUZZER_H +#define TEST_FUZZTEST_HOOK_MGR_DESTROY_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "HookMgrDestroy_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/HookMgrDestroy_fuzzer/corpus/init b/test/fuzztest/HookMgrDestroy_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/HookMgrDestroy_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/HookMgrDestroy_fuzzer/project.xml b/test/fuzztest/HookMgrDestroy_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/HookMgrDestroy_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/HookMgrExecute_fuzzer/HookMgrExecute_fuzzer.cpp b/test/fuzztest/HookMgrExecute_fuzzer/HookMgrExecute_fuzzer.cpp new file mode 100644 index 00000000..b5475e20 --- /dev/null +++ b/test/fuzztest/HookMgrExecute_fuzzer/HookMgrExecute_fuzzer.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "HookMgrExecute_fuzzer.h" +#include +#include "hookmgr.h" + +namespace OHOS { + bool FuzzHookMgrExecute(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + + HOOK_MGR *hookMgr = HookMgrCreate(str.c_str()); + if (HookMgrExecute(hookMgr, 0, nullptr, nullptr)) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzHookMgrExecute(data, size); + return 0; +} \ No newline at end of file diff --git a/test/fuzztest/HookMgrExecute_fuzzer/HookMgrExecute_fuzzer.h b/test/fuzztest/HookMgrExecute_fuzzer/HookMgrExecute_fuzzer.h new file mode 100644 index 00000000..be56057a --- /dev/null +++ b/test/fuzztest/HookMgrExecute_fuzzer/HookMgrExecute_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_HOOK_MGR_EXECUTE_FUZZER_H +#define TEST_FUZZTEST_HOOK_MGR_EXECUTE_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "HookMgrExecute_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/HookMgrExecute_fuzzer/corpus/init b/test/fuzztest/HookMgrExecute_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/HookMgrExecute_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/HookMgrExecute_fuzzer/project.xml b/test/fuzztest/HookMgrExecute_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/HookMgrExecute_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/HookMgrGetHooksCnt_fuzzer/HookMgrGetHooksCnt_fuzzer.cpp b/test/fuzztest/HookMgrGetHooksCnt_fuzzer/HookMgrGetHooksCnt_fuzzer.cpp new file mode 100644 index 00000000..024dc5d2 --- /dev/null +++ b/test/fuzztest/HookMgrGetHooksCnt_fuzzer/HookMgrGetHooksCnt_fuzzer.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "HookMgrGetHooksCnt_fuzzer.h" +#include +#include "hookmgr.h" + +namespace OHOS { + bool FuzzHookMgrGetHooksCnt(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + HOOK_MGR *hookMgr = HookMgrCreate(str.c_str()); + if (HookMgrGetHooksCnt(hookMgr, 0)) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzHookMgrGetHooksCnt(data, size); + return 0; +} diff --git a/test/fuzztest/HookMgrGetHooksCnt_fuzzer/HookMgrGetHooksCnt_fuzzer.h b/test/fuzztest/HookMgrGetHooksCnt_fuzzer/HookMgrGetHooksCnt_fuzzer.h new file mode 100644 index 00000000..2a3f708c --- /dev/null +++ b/test/fuzztest/HookMgrGetHooksCnt_fuzzer/HookMgrGetHooksCnt_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_HOOK_MGR_GET_HOOKS_CNT_FUZZER_H +#define TEST_FUZZTEST_HOOK_MGR_GET_HOOKS_CNT_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "HookMgrGetHooksCnt_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/HookMgrGetHooksCnt_fuzzer/corpus/init b/test/fuzztest/HookMgrGetHooksCnt_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/HookMgrGetHooksCnt_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/HookMgrGetHooksCnt_fuzzer/project.xml b/test/fuzztest/HookMgrGetHooksCnt_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/HookMgrGetHooksCnt_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/HookMgrGetStagesCnt_fuzzer/HookMgrGetStagesCnt_fuzzer.cpp b/test/fuzztest/HookMgrGetStagesCnt_fuzzer/HookMgrGetStagesCnt_fuzzer.cpp new file mode 100644 index 00000000..5256ed86 --- /dev/null +++ b/test/fuzztest/HookMgrGetStagesCnt_fuzzer/HookMgrGetStagesCnt_fuzzer.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "HookMgrGetStagesCnt_fuzzer.h" +#include +#include "hookmgr.h" + +namespace OHOS { + bool FuzzHookMgrGetStagesCnt(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + HOOK_MGR *hookMgr = HookMgrCreate(str.c_str()); + if (HookMgrGetStagesCnt(hookMgr)) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzHookMgrGetStagesCnt(data, size); + return 0; +} diff --git a/test/fuzztest/HookMgrGetStagesCnt_fuzzer/HookMgrGetStagesCnt_fuzzer.h b/test/fuzztest/HookMgrGetStagesCnt_fuzzer/HookMgrGetStagesCnt_fuzzer.h new file mode 100644 index 00000000..0ba35514 --- /dev/null +++ b/test/fuzztest/HookMgrGetStagesCnt_fuzzer/HookMgrGetStagesCnt_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_HOOK_MGR_GET_STAGES_CNT_FUZZER_H +#define TEST_FUZZTEST_HOOK_MGR_GET_STAGES_CNT_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "HookMgrGetStagesCnt_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/HookMgrGetStagesCnt_fuzzer/corpus/init b/test/fuzztest/HookMgrGetStagesCnt_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/HookMgrGetStagesCnt_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/HookMgrGetStagesCnt_fuzzer/project.xml b/test/fuzztest/HookMgrGetStagesCnt_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/HookMgrGetStagesCnt_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/HookMgrTraversal_fuzzer/HookMgrTraversal_fuzzer.cpp b/test/fuzztest/HookMgrTraversal_fuzzer/HookMgrTraversal_fuzzer.cpp new file mode 100644 index 00000000..c2a43183 --- /dev/null +++ b/test/fuzztest/HookMgrTraversal_fuzzer/HookMgrTraversal_fuzzer.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "HookMgrTraversal_fuzzer.h" +#include +#include "hookmgr.h" + +static void HookTraversal(const HOOK_INFO *hookInfo, void *traversalCookie) +{ + printf("hook traversal test!\n"); +} + +namespace OHOS { + bool FuzzHookMgrTraversal(const uint8_t* data, size_t size) + { + std::string str(reinterpret_cast(data), size); + HOOK_MGR *hookMgr = HookMgrCreate(str.c_str()); + HookMgrTraversal(hookMgr, nullptr, HookTraversal); + return true; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzHookMgrTraversal(data, size); + return 0; +} \ No newline at end of file diff --git a/test/fuzztest/HookMgrTraversal_fuzzer/HookMgrTraversal_fuzzer.h b/test/fuzztest/HookMgrTraversal_fuzzer/HookMgrTraversal_fuzzer.h new file mode 100644 index 00000000..a0ba2bd3 --- /dev/null +++ b/test/fuzztest/HookMgrTraversal_fuzzer/HookMgrTraversal_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_HOOK_MGR_TRAVERSAL_FUZZER_H +#define TEST_FUZZTEST_HOOK_MGR_TRAVERSAL_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "HookMgrTraversal_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/HookMgrTraversal_fuzzer/corpus/init b/test/fuzztest/HookMgrTraversal_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/HookMgrTraversal_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/HookMgrTraversal_fuzzer/project.xml b/test/fuzztest/HookMgrTraversal_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/HookMgrTraversal_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/IsSupportedFilesystem_fuzzer/IsSupportedFilesystem_fuzzer.cpp b/test/fuzztest/IsSupportedFilesystem_fuzzer/IsSupportedFilesystem_fuzzer.cpp new file mode 100644 index 00000000..07ddd54f --- /dev/null +++ b/test/fuzztest/IsSupportedFilesystem_fuzzer/IsSupportedFilesystem_fuzzer.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "IsSupportedFilesystem_fuzzer.h" +#include +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzIsSupportedFilesystem(const uint8_t* data, size_t size) + { + std::string str(reinterpret_cast(data), size); + return IsSupportedFilesystem(str.c_str()); + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzIsSupportedFilesystem(data, size); + return 0; +} diff --git a/test/fuzztest/IsSupportedFilesystem_fuzzer/IsSupportedFilesystem_fuzzer.h b/test/fuzztest/IsSupportedFilesystem_fuzzer/IsSupportedFilesystem_fuzzer.h new file mode 100644 index 00000000..617100dd --- /dev/null +++ b/test/fuzztest/IsSupportedFilesystem_fuzzer/IsSupportedFilesystem_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_IS_SUPPORTED_FILESYSTEM_FUZZER_H +#define TEST_FUZZTEST_IS_SUPPORTED_FILESYSTEM_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "IsSupportedFilesystem_fuzzer" +#endif diff --git a/test/fuzztest/IsSupportedFilesystem_fuzzer/corpus/init b/test/fuzztest/IsSupportedFilesystem_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/IsSupportedFilesystem_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/IsSupportedFilesystem_fuzzer/project.xml b/test/fuzztest/IsSupportedFilesystem_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/IsSupportedFilesystem_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/LoadFscryptPolicy_fuzzer/LoadFscryptPolicy_fuzzer.cpp b/test/fuzztest/LoadFscryptPolicy_fuzzer/LoadFscryptPolicy_fuzzer.cpp new file mode 100644 index 00000000..50d2f10c --- /dev/null +++ b/test/fuzztest/LoadFscryptPolicy_fuzzer/LoadFscryptPolicy_fuzzer.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "LoadFscryptPolicy_fuzzer.h" +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzLoadFscryptPolicy(const uint8_t* data, size_t size) + { + bool result = false; + char buff[1024] = {0}; + size_t len = sizeof(buff); + if (!LoadFscryptPolicy(buff, len)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzLoadFscryptPolicy(data, size); + return 0; +} diff --git a/test/fuzztest/LoadFscryptPolicy_fuzzer/LoadFscryptPolicy_fuzzer.h b/test/fuzztest/LoadFscryptPolicy_fuzzer/LoadFscryptPolicy_fuzzer.h new file mode 100644 index 00000000..3c1fd122 --- /dev/null +++ b/test/fuzztest/LoadFscryptPolicy_fuzzer/LoadFscryptPolicy_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_LOAD_FSCRYPT_POLICY_FUZZER_H +#define TEST_FUZZTEST_LOAD_FSCRYPT_POLICY_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "LoadFscryptPolicy_fuzzer" +#endif diff --git a/test/fuzztest/LoadFscryptPolicy_fuzzer/corpus/init b/test/fuzztest/LoadFscryptPolicy_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/LoadFscryptPolicy_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/LoadFscryptPolicy_fuzzer/project.xml b/test/fuzztest/LoadFscryptPolicy_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/LoadFscryptPolicy_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/LoadFstabFromCommandLine_fuzzer/LoadFstabFromCommandLine_fuzzer.cpp b/test/fuzztest/LoadFstabFromCommandLine_fuzzer/LoadFstabFromCommandLine_fuzzer.cpp new file mode 100644 index 00000000..ebba3594 --- /dev/null +++ b/test/fuzztest/LoadFstabFromCommandLine_fuzzer/LoadFstabFromCommandLine_fuzzer.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "LoadFstabFromCommandLine_fuzzer.h" +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzLoadFstabFromCommandLine(const uint8_t* data, size_t size) + { + bool result = false; + if (LoadFstabFromCommandLine() != nullptr) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzLoadFstabFromCommandLine(data, size); + return 0; +} diff --git a/test/fuzztest/LoadFstabFromCommandLine_fuzzer/LoadFstabFromCommandLine_fuzzer.h b/test/fuzztest/LoadFstabFromCommandLine_fuzzer/LoadFstabFromCommandLine_fuzzer.h new file mode 100644 index 00000000..1dc55b02 --- /dev/null +++ b/test/fuzztest/LoadFstabFromCommandLine_fuzzer/LoadFstabFromCommandLine_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_LOAD_FSTAB_FROM_COMMANDLINE_H +#define TEST_FUZZTEST_LOAD_FSTAB_FROM_COMMANDLINE_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "LoadFstabFromCommandLine_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/LoadFstabFromCommandLine_fuzzer/corpus/init b/test/fuzztest/LoadFstabFromCommandLine_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/LoadFstabFromCommandLine_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/LoadFstabFromCommandLine_fuzzer/project.xml b/test/fuzztest/LoadFstabFromCommandLine_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/LoadFstabFromCommandLine_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ModuleMgrCreate_fuzzer/ModuleMgrCreate_fuzzer.cpp b/test/fuzztest/ModuleMgrCreate_fuzzer/ModuleMgrCreate_fuzzer.cpp new file mode 100644 index 00000000..55f1b808 --- /dev/null +++ b/test/fuzztest/ModuleMgrCreate_fuzzer/ModuleMgrCreate_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ModuleMgrCreate_fuzzer.h" +#include +#include "modulemgr.h" + +namespace OHOS { + bool FuzzModuleMgrCreate(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + if (ModuleMgrCreate(str.c_str()) != nullptr) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzModuleMgrCreate(data, size); + return 0; +} diff --git a/test/fuzztest/ModuleMgrCreate_fuzzer/ModuleMgrCreate_fuzzer.h b/test/fuzztest/ModuleMgrCreate_fuzzer/ModuleMgrCreate_fuzzer.h new file mode 100644 index 00000000..cc9b065c --- /dev/null +++ b/test/fuzztest/ModuleMgrCreate_fuzzer/ModuleMgrCreate_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_SERVICE_CONTROL_FUZZER_H +#define TEST_FUZZTEST_SERVICE_CONTROL_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ServiceControl_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/ModuleMgrCreate_fuzzer/corpus/init b/test/fuzztest/ModuleMgrCreate_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ModuleMgrCreate_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ModuleMgrCreate_fuzzer/project.xml b/test/fuzztest/ModuleMgrCreate_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ModuleMgrCreate_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ModuleMgrDestroy_fuzzer/ModuleMgrDestroy_fuzzer.cpp b/test/fuzztest/ModuleMgrDestroy_fuzzer/ModuleMgrDestroy_fuzzer.cpp new file mode 100644 index 00000000..005e6de4 --- /dev/null +++ b/test/fuzztest/ModuleMgrDestroy_fuzzer/ModuleMgrDestroy_fuzzer.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ModuleMgrDestroy_fuzzer.h" +#include +#include +#include "modulemgr.h" + +namespace OHOS { + bool FuzzModuleMgrDestroy(const uint8_t* data, size_t size) + { + ModuleMgrDestroy(nullptr); + return true; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzModuleMgrDestroy(data, size); + return 0; +} diff --git a/test/fuzztest/ModuleMgrDestroy_fuzzer/ModuleMgrDestroy_fuzzer.h b/test/fuzztest/ModuleMgrDestroy_fuzzer/ModuleMgrDestroy_fuzzer.h new file mode 100644 index 00000000..7d7abdbf --- /dev/null +++ b/test/fuzztest/ModuleMgrDestroy_fuzzer/ModuleMgrDestroy_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_MODULE_MGR_DESTROY_FUZZER_H +#define TEST_FUZZTEST_MODULE_MGR_DESTROY_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ModuleMgrDestroy_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/ModuleMgrDestroy_fuzzer/corpus/init b/test/fuzztest/ModuleMgrDestroy_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ModuleMgrDestroy_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ModuleMgrDestroy_fuzzer/project.xml b/test/fuzztest/ModuleMgrDestroy_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ModuleMgrDestroy_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ModuleMgrGetCnt_fuzzer/ModuleMgrGetCnt_fuzzer.cpp b/test/fuzztest/ModuleMgrGetCnt_fuzzer/ModuleMgrGetCnt_fuzzer.cpp new file mode 100644 index 00000000..e1779e25 --- /dev/null +++ b/test/fuzztest/ModuleMgrGetCnt_fuzzer/ModuleMgrGetCnt_fuzzer.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ModuleMgrGetCnt_fuzzer.h" +#include +#include "modulemgr.h" + +namespace OHOS { + bool FuzzModuleMgrGetCnt(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + MODULE_MGR *moduleMgr = ModuleMgrCreate(str.c_str()); + + if (ModuleMgrGetCnt(moduleMgr)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzModuleMgrGetCnt(data, size); + return 0; +} \ No newline at end of file diff --git a/test/fuzztest/ModuleMgrGetCnt_fuzzer/ModuleMgrGetCnt_fuzzer.h b/test/fuzztest/ModuleMgrGetCnt_fuzzer/ModuleMgrGetCnt_fuzzer.h new file mode 100644 index 00000000..32374c6d --- /dev/null +++ b/test/fuzztest/ModuleMgrGetCnt_fuzzer/ModuleMgrGetCnt_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_MODULE_MGR_GET_CNT_FUZZER_H +#define TEST_FUZZTEST_MODULE_MGR_GET_CNT_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ModuleMgrGetCnt_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/ModuleMgrGetCnt_fuzzer/corpus/init b/test/fuzztest/ModuleMgrGetCnt_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ModuleMgrGetCnt_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ModuleMgrGetCnt_fuzzer/project.xml b/test/fuzztest/ModuleMgrGetCnt_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ModuleMgrGetCnt_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ModuleMgrInstall_fuzzer/ModuleMgrInstall_fuzzer.cpp b/test/fuzztest/ModuleMgrInstall_fuzzer/ModuleMgrInstall_fuzzer.cpp new file mode 100644 index 00000000..80449bb9 --- /dev/null +++ b/test/fuzztest/ModuleMgrInstall_fuzzer/ModuleMgrInstall_fuzzer.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ModuleMgrInstall_fuzzer.h" +#include +#include "modulemgr.h" + +namespace OHOS { + bool FuzzModuleMgrInstall(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + MODULE_MGR *moduleMgr = ModuleMgrCreate(str.c_str()); + if (!ModuleMgrInstall(moduleMgr, str.c_str(), 0, nullptr)) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzModuleMgrInstall(data, size); + return 0; +} diff --git a/test/fuzztest/ModuleMgrInstall_fuzzer/ModuleMgrInstall_fuzzer.h b/test/fuzztest/ModuleMgrInstall_fuzzer/ModuleMgrInstall_fuzzer.h new file mode 100644 index 00000000..913a8fb7 --- /dev/null +++ b/test/fuzztest/ModuleMgrInstall_fuzzer/ModuleMgrInstall_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_MODULE_MGR_INSTALL_FUZZER_H +#define TEST_FUZZTEST_MODULE_MGR_INSTALL_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ModuleMgrInstall_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/ModuleMgrInstall_fuzzer/corpus/init b/test/fuzztest/ModuleMgrInstall_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ModuleMgrInstall_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ModuleMgrInstall_fuzzer/project.xml b/test/fuzztest/ModuleMgrInstall_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ModuleMgrInstall_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ModuleMgrScan_fuzzer/ModuleMgrScan_fuzzer.cpp b/test/fuzztest/ModuleMgrScan_fuzzer/ModuleMgrScan_fuzzer.cpp new file mode 100644 index 00000000..480cf728 --- /dev/null +++ b/test/fuzztest/ModuleMgrScan_fuzzer/ModuleMgrScan_fuzzer.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ModuleMgrScan_fuzzer.h" +#include +#include "modulemgr.h" + +namespace OHOS { + bool FuzzModuleMgrScan(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + + if (ModuleMgrScan(str.c_str()) != nullptr) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzModuleMgrScan(data, size); + return 0; +} diff --git a/test/fuzztest/ModuleMgrScan_fuzzer/ModuleMgrScan_fuzzer.h b/test/fuzztest/ModuleMgrScan_fuzzer/ModuleMgrScan_fuzzer.h new file mode 100644 index 00000000..243ac026 --- /dev/null +++ b/test/fuzztest/ModuleMgrScan_fuzzer/ModuleMgrScan_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_MODULE_MGR_SCAN_FUZZER_H +#define TEST_FUZZTEST_MODULE_MGR_SCAN_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ModuleMgrScan_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/ModuleMgrScan_fuzzer/corpus/init b/test/fuzztest/ModuleMgrScan_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ModuleMgrScan_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ModuleMgrScan_fuzzer/project.xml b/test/fuzztest/ModuleMgrScan_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ModuleMgrScan_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ModuleMgrTraversal_fuzzer/ModuleMgrTraversal_fuzzer.cpp b/test/fuzztest/ModuleMgrTraversal_fuzzer/ModuleMgrTraversal_fuzzer.cpp new file mode 100644 index 00000000..09c1b069 --- /dev/null +++ b/test/fuzztest/ModuleMgrTraversal_fuzzer/ModuleMgrTraversal_fuzzer.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ModuleMgrTraversal_fuzzer.h" +#include +#include "modulemgr.h" + +static void ModuleTraversal(const MODULE_INFO *moduleInfo) +{ + printf("module name is: %s\n", moduleInfo->name); +} + +namespace OHOS { + bool FuzzModuleMgrTraversal(const uint8_t* data, size_t size) + { + std::string str(reinterpret_cast(data), size); + MODULE_MGR *moduleMgr = ModuleMgrCreate(str.c_str()); + ModuleMgrTraversal(moduleMgr, nullptr, ModuleTraversal); + return true; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzModuleMgrTraversal(data, size); + return 0; +} diff --git a/test/fuzztest/ModuleMgrTraversal_fuzzer/ModuleMgrTraversal_fuzzer.h b/test/fuzztest/ModuleMgrTraversal_fuzzer/ModuleMgrTraversal_fuzzer.h new file mode 100644 index 00000000..33e14b94 --- /dev/null +++ b/test/fuzztest/ModuleMgrTraversal_fuzzer/ModuleMgrTraversal_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_MODULE_MGR_TRAVERSAL_FUZZER_H +#define TEST_FUZZTEST_MODULE_MGR_TRAVERSAL_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ModuleMgrTraversal_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/ModuleMgrTraversal_fuzzer/corpus/init b/test/fuzztest/ModuleMgrTraversal_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ModuleMgrTraversal_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ModuleMgrTraversal_fuzzer/project.xml b/test/fuzztest/ModuleMgrTraversal_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ModuleMgrTraversal_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ModuleMgrUninstall_fuzzer/ModuleMgrUninstall_fuzzer.cpp b/test/fuzztest/ModuleMgrUninstall_fuzzer/ModuleMgrUninstall_fuzzer.cpp new file mode 100644 index 00000000..abbeba5b --- /dev/null +++ b/test/fuzztest/ModuleMgrUninstall_fuzzer/ModuleMgrUninstall_fuzzer.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ModuleMgrUninstall_fuzzer.h" +#include +#include "modulemgr.h" + +namespace OHOS { + bool FuzzModuleMgrUninstall(const uint8_t* data, size_t size) + { + std::string str(reinterpret_cast(data), size); + MODULE_MGR *moduleMgr = ModuleMgrCreate(str.c_str()); + ModuleMgrUninstall(moduleMgr, str.c_str()); + return true; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzModuleMgrUninstall(data, size); + return 0; +} diff --git a/test/fuzztest/ModuleMgrUninstall_fuzzer/ModuleMgrUninstall_fuzzer.h b/test/fuzztest/ModuleMgrUninstall_fuzzer/ModuleMgrUninstall_fuzzer.h new file mode 100644 index 00000000..774e5a24 --- /dev/null +++ b/test/fuzztest/ModuleMgrUninstall_fuzzer/ModuleMgrUninstall_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_MODULE_MGR_UNINSTALL_FUZZER_H +#define TEST_FUZZTEST_MODULE_MGR_UNINSTALL_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ModuleMgrUninstall_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/ModuleMgrUninstall_fuzzer/corpus/init b/test/fuzztest/ModuleMgrUninstall_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ModuleMgrUninstall_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ModuleMgrUninstall_fuzzer/project.xml b/test/fuzztest/ModuleMgrUninstall_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ModuleMgrUninstall_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/mountallfstab_fuzzer/mountallfstab_fuzzer.cpp b/test/fuzztest/MountAllWithFstabFile_fuzzer/MountAllWithFstabFile_fuzzer.cpp similarity index 91% rename from test/fuzztest/mountallfstab_fuzzer/mountallfstab_fuzzer.cpp rename to test/fuzztest/MountAllWithFstabFile_fuzzer/MountAllWithFstabFile_fuzzer.cpp index 504d9380..a3796f34 100644 --- a/test/fuzztest/mountallfstab_fuzzer/mountallfstab_fuzzer.cpp +++ b/test/fuzztest/MountAllWithFstabFile_fuzzer/MountAllWithFstabFile_fuzzer.cpp @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,8 +13,7 @@ * limitations under the License. */ -#include "mountallfstab_fuzzer.h" - +#include "MountAllWithFstabFile_fuzzer.h" #include #include "fs_manager/fs_manager.h" diff --git a/test/fuzztest/mountallfstab_fuzzer/mountallfstab_fuzzer.h b/test/fuzztest/MountAllWithFstabFile_fuzzer/MountAllWithFstabFile_fuzzer.h similarity index 87% rename from test/fuzztest/mountallfstab_fuzzer/mountallfstab_fuzzer.h rename to test/fuzztest/MountAllWithFstabFile_fuzzer/MountAllWithFstabFile_fuzzer.h index 5bae5047..c7c9a773 100644 --- a/test/fuzztest/mountallfstab_fuzzer/mountallfstab_fuzzer.h +++ b/test/fuzztest/MountAllWithFstabFile_fuzzer/MountAllWithFstabFile_fuzzer.h @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/test/fuzztest/MountAllWithFstabFile_fuzzer/corpus/init b/test/fuzztest/MountAllWithFstabFile_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/MountAllWithFstabFile_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/MountAllWithFstabFile_fuzzer/project.xml b/test/fuzztest/MountAllWithFstabFile_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/MountAllWithFstabFile_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/MountAllWithFstab_fuzzer/MountAllWithFstab_fuzzer.cpp b/test/fuzztest/MountAllWithFstab_fuzzer/MountAllWithFstab_fuzzer.cpp new file mode 100644 index 00000000..c38f75d4 --- /dev/null +++ b/test/fuzztest/MountAllWithFstab_fuzzer/MountAllWithFstab_fuzzer.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "MountAllWithFstab_fuzzer.h" +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzMountAllWithFstab(const uint8_t* data, size_t size) + { + bool result = false; + FILE *pFile = nullptr; + pFile = fopen("fstab.test", "w+"); + if (pFile == nullptr) { + std::cout << "[fuzz] open file fstab.test failed"; + return false; + } + if (fwrite(data, 1, size, pFile) != size) { + std::cout << "[fuzz] write data to fstab.test failed"; + (void)fclose(pFile); + return false; + } + (void)fclose(pFile); + CloseStdout(); + Fstab *fstab = ReadFstabFromFile("fstab.test", false); + if (!MountAllWithFstab(fstab, false)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzMountAllWithFstab(data, size); + return 0; +} diff --git a/test/fuzztest/MountAllWithFstab_fuzzer/MountAllWithFstab_fuzzer.h b/test/fuzztest/MountAllWithFstab_fuzzer/MountAllWithFstab_fuzzer.h new file mode 100644 index 00000000..ae7c1faa --- /dev/null +++ b/test/fuzztest/MountAllWithFstab_fuzzer/MountAllWithFstab_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_MOUNT_ALL_WITH_FSTAB_FUZZER_H +#define TEST_FUZZTEST_MOUNT_ALL_WITH_FSTAB_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "MountAllWithFstab_fuzzer" +#endif diff --git a/test/fuzztest/MountAllWithFstab_fuzzer/corpus/init b/test/fuzztest/MountAllWithFstab_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/MountAllWithFstab_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/MountAllWithFstab_fuzzer/project.xml b/test/fuzztest/MountAllWithFstab_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/MountAllWithFstab_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/MountOneItem_fuzzer/MountOneItem_fuzzer.cpp b/test/fuzztest/MountOneItem_fuzzer/MountOneItem_fuzzer.cpp new file mode 100644 index 00000000..930962d6 --- /dev/null +++ b/test/fuzztest/MountOneItem_fuzzer/MountOneItem_fuzzer.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "MountOneItem_fuzzer.h" +#include +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzMountOneItem(const uint8_t* data, size_t size) + { + bool result = false; + FILE *pFile = nullptr; + pFile = fopen("fstab.test", "w+"); + if (pFile == nullptr) { + std::cout << "[fuzz] open file fstab.test failed"; + return false; + } + if (fwrite(data, 1, size, pFile) != size) { + std::cout << "[fuzz] write data to fstab.test failed"; + (void)fclose(pFile); + return false; + } + (void)fclose(pFile); + CloseStdout(); + Fstab *fstab = ReadFstabFromFile("fstab.test", false); + + std::string str(reinterpret_cast(data), size); + FstabItem *item = FindFstabItemForPath(*fstab, str.c_str()); + if (!MountOneItem(item)) { + result = true; + }; + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzMountOneItem(data, size); + return 0; +} diff --git a/test/fuzztest/MountOneItem_fuzzer/MountOneItem_fuzzer.h b/test/fuzztest/MountOneItem_fuzzer/MountOneItem_fuzzer.h new file mode 100644 index 00000000..5841d32d --- /dev/null +++ b/test/fuzztest/MountOneItem_fuzzer/MountOneItem_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_DO_FORMAT_FUZZER_H +#define TEST_FUZZTEST_DO_FORMAT_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "DoFormat_fuzzer" +#endif diff --git a/test/fuzztest/MountOneItem_fuzzer/corpus/init b/test/fuzztest/MountOneItem_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/MountOneItem_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/MountOneItem_fuzzer/project.xml b/test/fuzztest/MountOneItem_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/MountOneItem_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ParseFstabPerLine_fuzzer/ParseFstabPerLine_fuzzer.cpp b/test/fuzztest/ParseFstabPerLine_fuzzer/ParseFstabPerLine_fuzzer.cpp new file mode 100644 index 00000000..837850f3 --- /dev/null +++ b/test/fuzztest/ParseFstabPerLine_fuzzer/ParseFstabPerLine_fuzzer.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ParseFstabPerLine_fuzzer.h" +#include +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzParseFstabPerLine(const uint8_t* data, size_t size) + { + bool result = false; + FILE *pFile = nullptr; + pFile = fopen("fstab.test", "w+"); + if (pFile == nullptr) { + std::cout << "[fuzz] open file fstab.test failed"; + return false; + } + if (fwrite(data, 1, size, pFile) != size) { + std::cout << "[fuzz] write data to fstab.test failed"; + (void)fclose(pFile); + return false; + } + (void)fclose(pFile); + CloseStdout(); + Fstab *fstab = ReadFstabFromFile("fstab.test", false); + + std::string str(reinterpret_cast(data), size); + if (ParseFstabPerLine(nullptr, fstab, false, str.c_str())) { + result = true; + }; + + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzParseFstabPerLine(data, size); + return 0; +} diff --git a/test/fuzztest/ParseFstabPerLine_fuzzer/ParseFstabPerLine_fuzzer.h b/test/fuzztest/ParseFstabPerLine_fuzzer/ParseFstabPerLine_fuzzer.h new file mode 100644 index 00000000..39dfc023 --- /dev/null +++ b/test/fuzztest/ParseFstabPerLine_fuzzer/ParseFstabPerLine_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_PARSE_FSTAB_PERLINE_FUZZER_H +#define TEST_FUZZTEST_PARSE_FSTAB_PERLINE_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ParseFstabPerLine_fuzzer" +#endif diff --git a/test/fuzztest/ParseFstabPerLine_fuzzer/corpus/init b/test/fuzztest/ParseFstabPerLine_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ParseFstabPerLine_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ParseFstabPerLine_fuzzer/project.xml b/test/fuzztest/ParseFstabPerLine_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ParseFstabPerLine_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ReadFstabFromFile_fuzzer/ReadFstabFromFile_fuzzer.cpp b/test/fuzztest/ReadFstabFromFile_fuzzer/ReadFstabFromFile_fuzzer.cpp new file mode 100644 index 00000000..74ff90f6 --- /dev/null +++ b/test/fuzztest/ReadFstabFromFile_fuzzer/ReadFstabFromFile_fuzzer.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ReadFstabFromFile_fuzzer.h" +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzReadFstabFromFile(const uint8_t* data, size_t size) + { + bool result = false; + FILE *pFile = nullptr; + pFile = fopen("fstab.test", "w+"); + if (pFile == nullptr) { + std::cout << "[fuzz] open file fstab.test failed"; + return false; + } + if (fwrite(data, 1, size, pFile) != size) { + std::cout << "[fuzz] write data to fstab.test failed"; + (void)fclose(pFile); + return false; + } + (void)fclose(pFile); + CloseStdout(); + if (ReadFstabFromFile("fstab.test", false) != nullptr) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzReadFstabFromFile(data, size); + return 0; +} diff --git a/test/fuzztest/ReadFstabFromFile_fuzzer/ReadFstabFromFile_fuzzer.h b/test/fuzztest/ReadFstabFromFile_fuzzer/ReadFstabFromFile_fuzzer.h new file mode 100644 index 00000000..3d21dfa6 --- /dev/null +++ b/test/fuzztest/ReadFstabFromFile_fuzzer/ReadFstabFromFile_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_READ_FSTAB_FROM_FILE_FUZZER_H +#define TEST_FUZZTEST_READ_FSTAB_FROM_FILE_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ReadFstabFromFile_fuzzer" +#endif diff --git a/test/fuzztest/ReadFstabFromFile_fuzzer/corpus/init b/test/fuzztest/ReadFstabFromFile_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ReadFstabFromFile_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ReadFstabFromFile_fuzzer/project.xml b/test/fuzztest/ReadFstabFromFile_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ReadFstabFromFile_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ReceiveFds_fuzzer/ReceiveFds_fuzzer.cpp b/test/fuzztest/ReceiveFds_fuzzer/ReceiveFds_fuzzer.cpp new file mode 100644 index 00000000..5ca2acd4 --- /dev/null +++ b/test/fuzztest/ReceiveFds_fuzzer/ReceiveFds_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include "fd_holder_internal.h" +#include "ReceiveFds_fuzzer.h" + +namespace OHOS { + bool FuzzReceiveFds(const uint8_t* data, size_t size) + { + bool result = false; + struct iovec iovec = {}; + if (!ReceiveFds(1, iovec, nullptr, false, nullptr)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzReceiveFds(data, size); + return 0; +} diff --git a/test/fuzztest/ReceiveFds_fuzzer/ReceiveFds_fuzzer.h b/test/fuzztest/ReceiveFds_fuzzer/ReceiveFds_fuzzer.h new file mode 100644 index 00000000..fe57a107 --- /dev/null +++ b/test/fuzztest/ReceiveFds_fuzzer/ReceiveFds_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_RECEIVE_FDS_H +#define TEST_FUZZTEST_RECEIVE_FDS_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ReceiveFds_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/ReceiveFds_fuzzer/corpus/init b/test/fuzztest/ReceiveFds_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ReceiveFds_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ReceiveFds_fuzzer/project.xml b/test/fuzztest/ReceiveFds_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ReceiveFds_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ReleaseFstab_fuzzer/ReleaseFstab_fuzzer.cpp b/test/fuzztest/ReleaseFstab_fuzzer/ReleaseFstab_fuzzer.cpp new file mode 100644 index 00000000..d0a24a25 --- /dev/null +++ b/test/fuzztest/ReleaseFstab_fuzzer/ReleaseFstab_fuzzer.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ReleaseFstab_fuzzer.h" +#include +#include "fs_manager/fs_manager.h" + +namespace OHOS { + bool FuzzReleaseFstab(const uint8_t* data, size_t size) + { + FILE *pFile = nullptr; + pFile = fopen("fstab.test", "w+"); + if (pFile == nullptr) { + std::cout << "[fuzz] open file fstab.test failed"; + return false; + } + if (fwrite(data, 1, size, pFile) != size) { + std::cout << "[fuzz] write data to fstab.test failed"; + (void)fclose(pFile); + return false; + } + (void)fclose(pFile); + CloseStdout(); + Fstab *fstab = ReadFstabFromFile("fstab.test", false); + ReleaseFstab(fstab); + return true; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzReleaseFstab(data, size); + return 0; +} diff --git a/test/fuzztest/ReleaseFstab_fuzzer/ReleaseFstab_fuzzer.h b/test/fuzztest/ReleaseFstab_fuzzer/ReleaseFstab_fuzzer.h new file mode 100644 index 00000000..2b7cf7a4 --- /dev/null +++ b/test/fuzztest/ReleaseFstab_fuzzer/ReleaseFstab_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_RELEASE_FSTAB_FUZZER_H +#define TEST_FUZZTEST_RELEASE_FSTAB_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ReleaseFstab_fuzzer" +#endif diff --git a/test/fuzztest/ReleaseFstab_fuzzer/corpus/init b/test/fuzztest/ReleaseFstab_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ReleaseFstab_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ReleaseFstab_fuzzer/project.xml b/test/fuzztest/ReleaseFstab_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ReleaseFstab_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/RemoveParameterWatcher_fuzzer/RemoveParameterWatcher_fuzzer.cpp b/test/fuzztest/RemoveParameterWatcher_fuzzer/RemoveParameterWatcher_fuzzer.cpp new file mode 100644 index 00000000..6c402015 --- /dev/null +++ b/test/fuzztest/RemoveParameterWatcher_fuzzer/RemoveParameterWatcher_fuzzer.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "RemoveParameterWatcher_fuzzer.h" +#include +#include "parameter.h" +#include "fuzz_utils.h" + +static void HandleParamChange(const char *key, const char *value, void *context) +{ + if (key == nullptr || value == nullptr) { + return; + } + printf("Receive parameter change %s %s \n", key, value); +} + +namespace OHOS { + bool FuzzRemoveParameterWatcher(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + CloseStdout(); + if (!RemoveParameterWatcher(str.c_str(), HandleParamChange, NULL)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzRemoveParameterWatcher(data, size); + return 0; +} diff --git a/test/fuzztest/RemoveParameterWatcher_fuzzer/RemoveParameterWatcher_fuzzer.h b/test/fuzztest/RemoveParameterWatcher_fuzzer/RemoveParameterWatcher_fuzzer.h new file mode 100644 index 00000000..53c80785 --- /dev/null +++ b/test/fuzztest/RemoveParameterWatcher_fuzzer/RemoveParameterWatcher_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_REMOVEWATCHPARAMETER_FUZZER_H +#define TEST_FUZZTEST_REMOVEWATCHPARAMETER_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "RemoveParameterWatcher_fuzzer" +#endif diff --git a/test/fuzztest/RemoveParameterWatcher_fuzzer/corpus/init b/test/fuzztest/RemoveParameterWatcher_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/RemoveParameterWatcher_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/RemoveParameterWatcher_fuzzer/project.xml b/test/fuzztest/RemoveParameterWatcher_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/RemoveParameterWatcher_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ServiceControlWithExtra_fuzzer/ServiceControlWithExtra_fuzzer.cpp b/test/fuzztest/ServiceControlWithExtra_fuzzer/ServiceControlWithExtra_fuzzer.cpp new file mode 100644 index 00000000..42ad59d3 --- /dev/null +++ b/test/fuzztest/ServiceControlWithExtra_fuzzer/ServiceControlWithExtra_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ServiceControlWithExtra_fuzzer.h" +#include +#include "service_control.h" + +namespace OHOS { + bool FuzzServiceControlWithExtra(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + if (!ServiceControlWithExtra(str.c_str(), START, nullptr, 1)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzServiceControlWithExtra(data, size); + return 0; +} diff --git a/test/fuzztest/ServiceControlWithExtra_fuzzer/ServiceControlWithExtra_fuzzer.h b/test/fuzztest/ServiceControlWithExtra_fuzzer/ServiceControlWithExtra_fuzzer.h new file mode 100644 index 00000000..5beeaabb --- /dev/null +++ b/test/fuzztest/ServiceControlWithExtra_fuzzer/ServiceControlWithExtra_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_SERVICE_CONTROL_WITH_EXTRA_FUZZER_H +#define TEST_FUZZTEST_SERVICE_CONTROL_WITH_EXTRA_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ServiceControlWithExtra_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/ServiceControlWithExtra_fuzzer/corpus/init b/test/fuzztest/ServiceControlWithExtra_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ServiceControlWithExtra_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ServiceControlWithExtra_fuzzer/project.xml b/test/fuzztest/ServiceControlWithExtra_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ServiceControlWithExtra_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ServiceControl_fuzzer/ServiceControl_fuzzer.cpp b/test/fuzztest/ServiceControl_fuzzer/ServiceControl_fuzzer.cpp new file mode 100644 index 00000000..7bab1e4e --- /dev/null +++ b/test/fuzztest/ServiceControl_fuzzer/ServiceControl_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ServiceControl_fuzzer.h" +#include +#include "service_control.h" + +namespace OHOS { + bool FuzzServiceControl(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + if (!ServiceControl(str.c_str(), START)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzServiceControl(data, size); + return 0; +} diff --git a/test/fuzztest/ServiceControl_fuzzer/ServiceControl_fuzzer.h b/test/fuzztest/ServiceControl_fuzzer/ServiceControl_fuzzer.h new file mode 100644 index 00000000..cc9b065c --- /dev/null +++ b/test/fuzztest/ServiceControl_fuzzer/ServiceControl_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_SERVICE_CONTROL_FUZZER_H +#define TEST_FUZZTEST_SERVICE_CONTROL_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ServiceControl_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/ServiceControl_fuzzer/corpus/init b/test/fuzztest/ServiceControl_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ServiceControl_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ServiceControl_fuzzer/project.xml b/test/fuzztest/ServiceControl_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ServiceControl_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ServiceGetFd_fuzzer/ServiceGetFd_fuzzer.cpp b/test/fuzztest/ServiceGetFd_fuzzer/ServiceGetFd_fuzzer.cpp new file mode 100644 index 00000000..d1c290f5 --- /dev/null +++ b/test/fuzztest/ServiceGetFd_fuzzer/ServiceGetFd_fuzzer.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ServiceGetFd_fuzzer.h" +#include +#include "fd_holder.h" + +namespace OHOS { + bool FuzzServiceGetFd(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + size_t fdCount[1] = {0}; + if (!ServiceGetFd(str.c_str(), fdCount)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzServiceGetFd(data, size); + return 0; +} diff --git a/test/fuzztest/ServiceGetFd_fuzzer/ServiceGetFd_fuzzer.h b/test/fuzztest/ServiceGetFd_fuzzer/ServiceGetFd_fuzzer.h new file mode 100644 index 00000000..976bdda9 --- /dev/null +++ b/test/fuzztest/ServiceGetFd_fuzzer/ServiceGetFd_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_SERVICE_GET_FD_FUZZER_H +#define TEST_FUZZTEST_SERVICE_GET_FD_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ServiceGetFd_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/ServiceGetFd_fuzzer/corpus/init b/test/fuzztest/ServiceGetFd_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ServiceGetFd_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ServiceGetFd_fuzzer/project.xml b/test/fuzztest/ServiceGetFd_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ServiceGetFd_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ServiceSaveFdWithPoll_fuzzer/ServiceSaveFdWithPoll_fuzzer.cpp b/test/fuzztest/ServiceSaveFdWithPoll_fuzzer/ServiceSaveFdWithPoll_fuzzer.cpp new file mode 100644 index 00000000..73373e00 --- /dev/null +++ b/test/fuzztest/ServiceSaveFdWithPoll_fuzzer/ServiceSaveFdWithPoll_fuzzer.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ServiceSaveFdWithPoll_fuzzer.h" +#include +#include "fd_holder.h" + +namespace OHOS { + bool FuzzServiceSaveFdWithPoll(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + int fds[64] = {0}; + int fdCount = 10; // fd count + if (!ServiceSaveFdWithPoll(str.c_str(), fds, fdCount)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzServiceSaveFdWithPoll(data, size); + return 0; +} diff --git a/test/fuzztest/ServiceSaveFdWithPoll_fuzzer/ServiceSaveFdWithPoll_fuzzer.h b/test/fuzztest/ServiceSaveFdWithPoll_fuzzer/ServiceSaveFdWithPoll_fuzzer.h new file mode 100644 index 00000000..561a0cfe --- /dev/null +++ b/test/fuzztest/ServiceSaveFdWithPoll_fuzzer/ServiceSaveFdWithPoll_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_SERVICE_SAVE_FD_WITH_POLL_FUZZER_H +#define TEST_FUZZTEST_SERVICE_SAVE_FD_WITH_POLL_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ServiceSaveFdWithPoll_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/ServiceSaveFdWithPoll_fuzzer/corpus/init b/test/fuzztest/ServiceSaveFdWithPoll_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ServiceSaveFdWithPoll_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ServiceSaveFdWithPoll_fuzzer/project.xml b/test/fuzztest/ServiceSaveFdWithPoll_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ServiceSaveFdWithPoll_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ServiceSaveFd_fuzzer/ServiceSaveFd_fuzzer.cpp b/test/fuzztest/ServiceSaveFd_fuzzer/ServiceSaveFd_fuzzer.cpp new file mode 100644 index 00000000..bf9102ef --- /dev/null +++ b/test/fuzztest/ServiceSaveFd_fuzzer/ServiceSaveFd_fuzzer.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ServiceSaveFd_fuzzer.h" +#include +#include "fd_holder.h" + +namespace OHOS { + bool FuzzServiceSaveFd(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + int fd[64] = {0}; + int count = 10; + if (!ServiceSaveFd(str.c_str(), fd, count)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzServiceSaveFd(data, size); + return 0; +} diff --git a/test/fuzztest/ServiceSaveFd_fuzzer/ServiceSaveFd_fuzzer.h b/test/fuzztest/ServiceSaveFd_fuzzer/ServiceSaveFd_fuzzer.h new file mode 100644 index 00000000..60cef4fb --- /dev/null +++ b/test/fuzztest/ServiceSaveFd_fuzzer/ServiceSaveFd_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_SERVICE_SAVE_FD_FUZZER_H +#define TEST_FUZZTEST_SERVICE_SAVE_FD_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ServiceSaveFd_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/ServiceSaveFd_fuzzer/corpus/init b/test/fuzztest/ServiceSaveFd_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ServiceSaveFd_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ServiceSaveFd_fuzzer/project.xml b/test/fuzztest/ServiceSaveFd_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ServiceSaveFd_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ServiceSetReady_fuzzer/ServiceSetReady_fuzzer.cpp b/test/fuzztest/ServiceSetReady_fuzzer/ServiceSetReady_fuzzer.cpp new file mode 100644 index 00000000..9ef5c581 --- /dev/null +++ b/test/fuzztest/ServiceSetReady_fuzzer/ServiceSetReady_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ServiceSetReady_fuzzer.h" +#include +#include "service_control.h" + +namespace OHOS { + bool FuzzServiceSetReady(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + if (!ServiceSetReady(str.c_str())) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzServiceSetReady(data, size); + return 0; +} diff --git a/test/fuzztest/ServiceSetReady_fuzzer/ServiceSetReady_fuzzer.h b/test/fuzztest/ServiceSetReady_fuzzer/ServiceSetReady_fuzzer.h new file mode 100644 index 00000000..db1b0973 --- /dev/null +++ b/test/fuzztest/ServiceSetReady_fuzzer/ServiceSetReady_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_SERVICE_SET_READY_FUZZER_H +#define TEST_FUZZTEST_SERVICE_SET_READY_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ServiceSetReady_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/ServiceSetReady_fuzzer/corpus/init b/test/fuzztest/ServiceSetReady_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ServiceSetReady_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ServiceSetReady_fuzzer/project.xml b/test/fuzztest/ServiceSetReady_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ServiceSetReady_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ServiceWaitForStatus_fuzzer/ServiceWaitForStatus_fuzzer.cpp b/test/fuzztest/ServiceWaitForStatus_fuzzer/ServiceWaitForStatus_fuzzer.cpp new file mode 100644 index 00000000..704fe491 --- /dev/null +++ b/test/fuzztest/ServiceWaitForStatus_fuzzer/ServiceWaitForStatus_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ServiceWaitForStatus_fuzzer.h" +#include +#include "service_control.h" + +namespace OHOS { + bool FuzzServiceWaitForStatus(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + if (!ServiceWaitForStatus(str.c_str(), SERVICE_STARTED, 1)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzServiceWaitForStatus(data, size); + return 0; +} diff --git a/test/fuzztest/ServiceWaitForStatus_fuzzer/ServiceWaitForStatus_fuzzer.h b/test/fuzztest/ServiceWaitForStatus_fuzzer/ServiceWaitForStatus_fuzzer.h new file mode 100644 index 00000000..a8199f8d --- /dev/null +++ b/test/fuzztest/ServiceWaitForStatus_fuzzer/ServiceWaitForStatus_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_SERVICE_WAIT_FOR_STATUS_FUZZER_H +#define TEST_FUZZTEST_SERVICE_WAIT_FOR_STATUS_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ServiceWaitForStatus_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/ServiceWaitForStatus_fuzzer/corpus/init b/test/fuzztest/ServiceWaitForStatus_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ServiceWaitForStatus_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ServiceWaitForStatus_fuzzer/project.xml b/test/fuzztest/ServiceWaitForStatus_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ServiceWaitForStatus_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/ServiceWatchForStatus_fuzzer/ServiceWatchForStatus_fuzzer.cpp b/test/fuzztest/ServiceWatchForStatus_fuzzer/ServiceWatchForStatus_fuzzer.cpp new file mode 100644 index 00000000..275357ed --- /dev/null +++ b/test/fuzztest/ServiceWatchForStatus_fuzzer/ServiceWatchForStatus_fuzzer.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ServiceWatchForStatus_fuzzer.h" +#include +#include "service_watcher.h" +#include "fuzz_utils.h" + +void callback(const char *key, ServiceStatus status) +{ + printf("key is: %s, ServiceStatus is: %d\n", key, status); +} + +namespace OHOS { + bool FuzzServiceWatchForStatus(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + CloseStdout(); + if (!ServiceWatchForStatus(str.c_str(), callback)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzServiceWatchForStatus(data, size); + return 0; +} diff --git a/test/fuzztest/ServiceWatchForStatus_fuzzer/ServiceWatchForStatus_fuzzer.h b/test/fuzztest/ServiceWatchForStatus_fuzzer/ServiceWatchForStatus_fuzzer.h new file mode 100644 index 00000000..99a79ca4 --- /dev/null +++ b/test/fuzztest/ServiceWatchForStatus_fuzzer/ServiceWatchForStatus_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_SERVICE_WATCH_FOR_STATUS_FUZZER_H +#define TEST_FUZZTEST_SERVICE_WATCH_FOR_STATUS_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "ServiceWatchForStatus_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/ServiceWatchForStatus_fuzzer/corpus/init b/test/fuzztest/ServiceWatchForStatus_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/ServiceWatchForStatus_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ServiceWatchForStatus_fuzzer/project.xml b/test/fuzztest/ServiceWatchForStatus_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/ServiceWatchForStatus_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/SetParameterC_fuzzer/SetParameterC_fuzzer.cpp b/test/fuzztest/SetParameterC_fuzzer/SetParameterC_fuzzer.cpp new file mode 100644 index 00000000..8c66321f --- /dev/null +++ b/test/fuzztest/SetParameterC_fuzzer/SetParameterC_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "SetParameterC_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzSetParameterC(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + if (!SetParameter(str.c_str(), str.c_str())) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzSetParameterC(data, size); + return 0; +} diff --git a/test/fuzztest/SetParameterC_fuzzer/SetParameterC_fuzzer.h b/test/fuzztest/SetParameterC_fuzzer/SetParameterC_fuzzer.h new file mode 100644 index 00000000..0c71d0a4 --- /dev/null +++ b/test/fuzztest/SetParameterC_fuzzer/SetParameterC_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_SETPARAMETER_C_FUZZER_H +#define TEST_FUZZTEST_SETPARAMETER_C_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "SetParameterC_fuzzer" +#endif diff --git a/test/fuzztest/SetParameterC_fuzzer/corpus/init b/test/fuzztest/SetParameterC_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/SetParameterC_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/SetParameterC_fuzzer/project.xml b/test/fuzztest/SetParameterC_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/SetParameterC_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/SetParameterCpp_fuzzer/SetParameterCpp_fuzzer.cpp b/test/fuzztest/SetParameterCpp_fuzzer/SetParameterCpp_fuzzer.cpp new file mode 100644 index 00000000..2f074921 --- /dev/null +++ b/test/fuzztest/SetParameterCpp_fuzzer/SetParameterCpp_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "SetParameterCpp_fuzzer.h" +#include +#include "parameters.h" + +namespace OHOS { + bool FuzzSetParameter(const uint8_t* data, size_t size) + { + bool result = false; + std::string key(reinterpret_cast(data), size); + if (system::SetParameter(key, key)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzSetParameter(data, size); + return 0; +} diff --git a/test/fuzztest/SetParameterCpp_fuzzer/SetParameterCpp_fuzzer.h b/test/fuzztest/SetParameterCpp_fuzzer/SetParameterCpp_fuzzer.h new file mode 100644 index 00000000..ab4835e1 --- /dev/null +++ b/test/fuzztest/SetParameterCpp_fuzzer/SetParameterCpp_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_SET_PARAMETER_CPP_FUZZER_H +#define TEST_FUZZTEST_SET_PARAMETER_CPP_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "SetParameterCpp_fuzzer" +#endif diff --git a/test/fuzztest/SetParameterCpp_fuzzer/corpus/init b/test/fuzztest/SetParameterCpp_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/SetParameterCpp_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/SetParameterCpp_fuzzer/project.xml b/test/fuzztest/SetParameterCpp_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/SetParameterCpp_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/systemwaitparameter_fuzzer/systemwaitparameter_fuzzer.cpp b/test/fuzztest/StartServiceByTimer_fuzzer/StartServiceByTimer_fuzzer.cpp similarity index 71% rename from test/fuzztest/systemwaitparameter_fuzzer/systemwaitparameter_fuzzer.cpp rename to test/fuzztest/StartServiceByTimer_fuzzer/StartServiceByTimer_fuzzer.cpp index c13951ee..d02ce436 100644 --- a/test/fuzztest/systemwaitparameter_fuzzer/systemwaitparameter_fuzzer.cpp +++ b/test/fuzztest/StartServiceByTimer_fuzzer/StartServiceByTimer_fuzzer.cpp @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,16 +13,16 @@ * limitations under the License. */ -#include "systemwaitparameter_fuzzer.h" +#include "StartServiceByTimer_fuzzer.h" #include -#include "init_param.h" +#include "service_control.h" namespace OHOS { - bool FuzzSystemWaitParameter(const uint8_t* data, size_t size) + bool FuzzStartServiceByTimer(const uint8_t* data, size_t size) { bool result = false; std::string str(reinterpret_cast(data), size); - if (!SystemWaitParameter(str.c_str(), str.c_str(), 1)) { + if (!StartServiceByTimer(str.c_str(), 1)) { result = true; } return result; @@ -33,6 +33,6 @@ namespace OHOS { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ - OHOS::FuzzSystemWaitParameter(data, size); + OHOS::FuzzStartServiceByTimer(data, size); return 0; } diff --git a/test/fuzztest/StartServiceByTimer_fuzzer/StartServiceByTimer_fuzzer.h b/test/fuzztest/StartServiceByTimer_fuzzer/StartServiceByTimer_fuzzer.h new file mode 100644 index 00000000..4a954b31 --- /dev/null +++ b/test/fuzztest/StartServiceByTimer_fuzzer/StartServiceByTimer_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_START_SERVICE_BY_TIMER_FUZZER_H +#define TEST_FUZZTEST_START_SERVICE_BY_TIMER_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "StartServiceByTimer_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/StartServiceByTimer_fuzzer/corpus/init b/test/fuzztest/StartServiceByTimer_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/StartServiceByTimer_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/StartServiceByTimer_fuzzer/project.xml b/test/fuzztest/StartServiceByTimer_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/StartServiceByTimer_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/StopServiceTimer_fuzzer/StopServiceTimer_fuzzer.cpp b/test/fuzztest/StopServiceTimer_fuzzer/StopServiceTimer_fuzzer.cpp new file mode 100644 index 00000000..76bc370f --- /dev/null +++ b/test/fuzztest/StopServiceTimer_fuzzer/StopServiceTimer_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "StopServiceTimer_fuzzer.h" +#include +#include "service_control.h" + +namespace OHOS { + bool FuzzStopServiceTimer(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + if (!StopServiceTimer(str.c_str())) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzStopServiceTimer(data, size); + return 0; +} diff --git a/test/fuzztest/StopServiceTimer_fuzzer/StopServiceTimer_fuzzer.h b/test/fuzztest/StopServiceTimer_fuzzer/StopServiceTimer_fuzzer.h new file mode 100644 index 00000000..9d45b543 --- /dev/null +++ b/test/fuzztest/StopServiceTimer_fuzzer/StopServiceTimer_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_STOP_SERVICE_TIMER_FUZZER_H +#define TEST_FUZZTEST_STOP_SERVICE_TIMER_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "StopServiceTimer_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/StopServiceTimer_fuzzer/corpus/init b/test/fuzztest/StopServiceTimer_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/StopServiceTimer_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/StopServiceTimer_fuzzer/project.xml b/test/fuzztest/StopServiceTimer_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/StopServiceTimer_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/umountallfstab_fuzzer/umountallfstab_fuzzer.cpp b/test/fuzztest/UmountAllWithFstabFile_fuzzer/UmountAllWithFstabFile_fuzzer.cpp similarity index 91% rename from test/fuzztest/umountallfstab_fuzzer/umountallfstab_fuzzer.cpp rename to test/fuzztest/UmountAllWithFstabFile_fuzzer/UmountAllWithFstabFile_fuzzer.cpp index d8d43a9a..4deda419 100644 --- a/test/fuzztest/umountallfstab_fuzzer/umountallfstab_fuzzer.cpp +++ b/test/fuzztest/UmountAllWithFstabFile_fuzzer/UmountAllWithFstabFile_fuzzer.cpp @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,8 +13,7 @@ * limitations under the License. */ -#include "umountallfstab_fuzzer.h" - +#include "UmountAllWithFstabFile_fuzzer.h" #include #include "fs_manager/fs_manager.h" diff --git a/test/fuzztest/umountallfstab_fuzzer/umountallfstab_fuzzer.h b/test/fuzztest/UmountAllWithFstabFile_fuzzer/UmountAllWithFstabFile_fuzzer.h similarity index 87% rename from test/fuzztest/umountallfstab_fuzzer/umountallfstab_fuzzer.h rename to test/fuzztest/UmountAllWithFstabFile_fuzzer/UmountAllWithFstabFile_fuzzer.h index 9617f1f3..805271e3 100644 --- a/test/fuzztest/umountallfstab_fuzzer/umountallfstab_fuzzer.h +++ b/test/fuzztest/UmountAllWithFstabFile_fuzzer/UmountAllWithFstabFile_fuzzer.h @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/test/fuzztest/UmountAllWithFstabFile_fuzzer/corpus/init b/test/fuzztest/UmountAllWithFstabFile_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/UmountAllWithFstabFile_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/UmountAllWithFstabFile_fuzzer/project.xml b/test/fuzztest/UmountAllWithFstabFile_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/UmountAllWithFstabFile_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/WaitParameter_fuzzer/WaitParameter_fuzzer.cpp b/test/fuzztest/WaitParameter_fuzzer/WaitParameter_fuzzer.cpp new file mode 100644 index 00000000..2aecae8b --- /dev/null +++ b/test/fuzztest/WaitParameter_fuzzer/WaitParameter_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "WaitParameter_fuzzer.h" +#include +#include "parameter.h" + +namespace OHOS { + bool FuzzWaitParameter(const uint8_t* data, size_t size) + { + bool result = false; + std::string str(reinterpret_cast(data), size); + if (!WaitParameter(str.c_str(), str.c_str(), 1)) { + result = true; + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzWaitParameter(data, size); + return 0; +} diff --git a/test/fuzztest/WaitParameter_fuzzer/WaitParameter_fuzzer.h b/test/fuzztest/WaitParameter_fuzzer/WaitParameter_fuzzer.h new file mode 100644 index 00000000..be78a56f --- /dev/null +++ b/test/fuzztest/WaitParameter_fuzzer/WaitParameter_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_WAITPARAMETER_FUZZER_H +#define TEST_FUZZTEST_WAITPARAMETER_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "WaitParameter_fuzzer" +#endif diff --git a/test/fuzztest/WaitParameter_fuzzer/corpus/init b/test/fuzztest/WaitParameter_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/WaitParameter_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/WaitParameter_fuzzer/project.xml b/test/fuzztest/WaitParameter_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/WaitParameter_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/systemwatchparameter_fuzzer/systemwatchparameter_fuzzer.cpp b/test/fuzztest/WatchParameter_fuzzer/WatchParameter_fuzzer.cpp similarity index 73% rename from test/fuzztest/systemwatchparameter_fuzzer/systemwatchparameter_fuzzer.cpp rename to test/fuzztest/WatchParameter_fuzzer/WatchParameter_fuzzer.cpp index 4ef502d1..04dad12b 100644 --- a/test/fuzztest/systemwatchparameter_fuzzer/systemwatchparameter_fuzzer.cpp +++ b/test/fuzztest/WatchParameter_fuzzer/WatchParameter_fuzzer.cpp @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,27 +13,26 @@ * limitations under the License. */ +#include "WatchParameter_fuzzer.h" #include -#include "systemwatchparameter_fuzzer.h" - -#include "init.h" -#include "init_param.h" +#include "parameter.h" +#include "fuzz_utils.h" static void HandleParamChange(const char *key, const char *value, void *context) { if (key == nullptr || value == nullptr) { return; } - UNUSED(context); printf("Receive parameter change %s %s \n", key, value); } namespace OHOS { - bool FuzzSystemWatchParameter(const uint8_t* data, size_t size) + bool FuzzWatchParameter(const uint8_t* data, size_t size) { bool result = false; std::string str(reinterpret_cast(data), size); - if (!SystemWatchParameter(str.c_str(), HandleParamChange, NULL)) { + CloseStdout(); + if (!WatchParameter(str.c_str(), HandleParamChange, NULL)) { result = true; } return result; @@ -44,6 +43,6 @@ namespace OHOS { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ - OHOS::FuzzSystemWatchParameter(data, size); + OHOS::FuzzWatchParameter(data, size); return 0; } diff --git a/test/fuzztest/WatchParameter_fuzzer/WatchParameter_fuzzer.h b/test/fuzztest/WatchParameter_fuzzer/WatchParameter_fuzzer.h new file mode 100644 index 00000000..48cf1d9c --- /dev/null +++ b/test/fuzztest/WatchParameter_fuzzer/WatchParameter_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_WATCHPARAMETER_FUZZER_H +#define TEST_FUZZTEST_WATCHPARAMETER_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "WatchParameter_fuzzer" +#endif diff --git a/test/fuzztest/WatchParameter_fuzzer/corpus/init b/test/fuzztest/WatchParameter_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/test/fuzztest/WatchParameter_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/WatchParameter_fuzzer/project.xml b/test/fuzztest/WatchParameter_fuzzer/project.xml new file mode 100644 index 00000000..949d03ef --- /dev/null +++ b/test/fuzztest/WatchParameter_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + diff --git a/test/fuzztest/doreboot_fuzzer/doreboot_fuzzer.cpp b/test/fuzztest/doreboot_fuzzer/doreboot_fuzzer.cpp index edcd54d8..98e21ac1 100644 --- a/test/fuzztest/doreboot_fuzzer/doreboot_fuzzer.cpp +++ b/test/fuzztest/doreboot_fuzzer/doreboot_fuzzer.cpp @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/test/fuzztest/doreboot_fuzzer/doreboot_fuzzer.h b/test/fuzztest/doreboot_fuzzer/doreboot_fuzzer.h index 987ccbd7..e5f26c48 100644 --- a/test/fuzztest/doreboot_fuzzer/doreboot_fuzzer.h +++ b/test/fuzztest/doreboot_fuzzer/doreboot_fuzzer.h @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/test/fuzztest/doreboot_fuzzer/project.xml b/test/fuzztest/doreboot_fuzzer/project.xml index 428e0f27..949d03ef 100644 --- a/test/fuzztest/doreboot_fuzzer/project.xml +++ b/test/fuzztest/doreboot_fuzzer/project.xml @@ -1,5 +1,5 @@ - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/systemgetparametername_fuzzer/systemgetparametername_fuzzer.h b/test/fuzztest/systemgetparametername_fuzzer/systemgetparametername_fuzzer.h deleted file mode 100644 index 6c9a62a4..00000000 --- a/test/fuzztest/systemgetparametername_fuzzer/systemgetparametername_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef TEST_FUZZTEST_SYSTEMGETPARAMETERNAME_FUZZER_H -#define TEST_FUZZTEST_SYSTEMGETPARAMETERNAME_FUZZER_H -#include "fuzz_utils.h" -#define FUZZ_PROJECT_NAME "SystemGetParameterName_fuzzer" -#endif diff --git a/test/fuzztest/systemgetparametervalue_fuzzer/project.xml b/test/fuzztest/systemgetparametervalue_fuzzer/project.xml deleted file mode 100644 index 428e0f27..00000000 --- a/test/fuzztest/systemgetparametervalue_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/systemgetparametervalue_fuzzer/systemgetparametervalue_fuzzer.h b/test/fuzztest/systemgetparametervalue_fuzzer/systemgetparametervalue_fuzzer.h deleted file mode 100644 index 0aa2736f..00000000 --- a/test/fuzztest/systemgetparametervalue_fuzzer/systemgetparametervalue_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef TEST_FUZZTEST_SYSTEMGETPARAMETERVALUE_FUZZER_H -#define TEST_FUZZTEST_SYSTEMGETPARAMETERVALUE_FUZZER_H -#include "fuzz_utils.h" -#define FUZZ_PROJECT_NAME "SystemGetParameterValue_fuzzer" -#endif diff --git a/test/fuzztest/systemsetparameter_fuzzer/project.xml b/test/fuzztest/systemsetparameter_fuzzer/project.xml deleted file mode 100644 index 428e0f27..00000000 --- a/test/fuzztest/systemsetparameter_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/systemsetparameter_fuzzer/systemsetparameter_fuzzer.h b/test/fuzztest/systemsetparameter_fuzzer/systemsetparameter_fuzzer.h deleted file mode 100644 index 977c3be8..00000000 --- a/test/fuzztest/systemsetparameter_fuzzer/systemsetparameter_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef TEST_FUZZTEST_SYSTEMSETPARAMETER_FUZZER_H -#define TEST_FUZZTEST_SYSTEMSETPARAMETER_FUZZER_H -#include "fuzz_utils.h" -#define FUZZ_PROJECT_NAME "SystemSetParameter_fuzzer" -#endif diff --git a/test/fuzztest/systemtraversalparameter_fuzzer/project.xml b/test/fuzztest/systemtraversalparameter_fuzzer/project.xml index 428e0f27..949d03ef 100644 --- a/test/fuzztest/systemtraversalparameter_fuzzer/project.xml +++ b/test/fuzztest/systemtraversalparameter_fuzzer/project.xml @@ -1,5 +1,5 @@ - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/systemwaitparameter_fuzzer/systemwaitparameter_fuzzer.h b/test/fuzztest/systemwaitparameter_fuzzer/systemwaitparameter_fuzzer.h deleted file mode 100644 index 96bb7fcf..00000000 --- a/test/fuzztest/systemwaitparameter_fuzzer/systemwaitparameter_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef TEST_FUZZTEST_SYSTEMWAITPARAMETER_FUZZER_H -#define TEST_FUZZTEST_SYSTEMWAITPARAMETER_FUZZER_H -#include "fuzz_utils.h" -#define FUZZ_PROJECT_NAME "SystemWaitParameter_fuzzer" -#endif diff --git a/test/fuzztest/systemwatchparameter_fuzzer/project.xml b/test/fuzztest/systemwatchparameter_fuzzer/project.xml deleted file mode 100644 index 428e0f27..00000000 --- a/test/fuzztest/systemwatchparameter_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/systemwatchparameter_fuzzer/systemwatchparameter_fuzzer.h b/test/fuzztest/systemwatchparameter_fuzzer/systemwatchparameter_fuzzer.h deleted file mode 100644 index 89628e8c..00000000 --- a/test/fuzztest/systemwatchparameter_fuzzer/systemwatchparameter_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef TEST_FUZZTEST_SYSTEMWATCHPARAMETER_FUZZER_H -#define TEST_FUZZTEST_SYSTEMWATCHPARAMETER_FUZZER_H -#include "fuzz_utils.h" -#define FUZZ_PROJECT_NAME "SystemWatchParameter_fuzzer" -#endif diff --git a/test/fuzztest/umountallfstab_fuzzer/project.xml b/test/fuzztest/umountallfstab_fuzzer/project.xml deleted file mode 100644 index 428e0f27..00000000 --- a/test/fuzztest/umountallfstab_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/utils/fuzz_utils.cpp b/test/fuzztest/utils/fuzz_utils.cpp index 5470da63..5881b692 100644 --- a/test/fuzztest/utils/fuzz_utils.cpp +++ b/test/fuzztest/utils/fuzz_utils.cpp @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -25,4 +25,4 @@ void CloseStdout(void) } dup2(fd, 1); close(fd); -} +} \ No newline at end of file diff --git a/test/fuzztest/utils/include/fuzz_utils.h b/test/fuzztest/utils/include/fuzz_utils.h index 73193fcb..1de03beb 100644 --- a/test/fuzztest/utils/include/fuzz_utils.h +++ b/test/fuzztest/utils/include/fuzz_utils.h @@ -1,10 +1,10 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, -- GitLab