From fc3fff01b0d25295546dc2c75a6bb14ab3746b2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=BE=E9=98=B3=E7=86=A0?= Date: Sat, 9 Aug 2025 19:21:06 +0800 Subject: [PATCH 1/4] Signed-off-by: qianyangyi --- test/fuzztest/BUILD.gn | 522 +----------------- test/fuzztest/getbootslots_fuzzer/corpus/init | 16 - .../getbootslots_fuzzer.cpp | 34 -- .../getbootslots_fuzzer/getbootslots_fuzzer.h | 20 - test/fuzztest/getbootslots_fuzzer/project.xml | 25 - test/fuzztest/getbrand_fuzzer/corpus/init | 16 - .../getbrand_fuzzer/getbrand_fuzzer.cpp | 37 -- .../getbrand_fuzzer/getbrand_fuzzer.h | 20 - test/fuzztest/getbrand_fuzzer/project.xml | 25 - test/fuzztest/getbuildhost_fuzzer/corpus/init | 16 - .../getbuildhost_fuzzer.cpp | 37 -- .../getbuildhost_fuzzer/getbuildhost_fuzzer.h | 20 - test/fuzztest/getbuildhost_fuzzer/project.xml | 25 - .../getbuildversion_fuzzer/corpus/init | 16 - .../getbuildversion_fuzzer.cpp | 37 -- .../getbuildversion_fuzzer.h | 20 - .../getbuildversion_fuzzer/project.xml | 25 - .../getdevicetypec_fuzzer/corpus/init | 16 - .../getdevicetypec_fuzzer.cpp | 37 -- .../getdevicetypec_fuzzer.h | 20 - .../getdevicetypec_fuzzer/project.xml | 25 - .../getdevudid_fuzzer/getdevudid_fuzzer.cpp | 18 +- .../getdisplayversion_fuzzer/corpus/init | 16 - .../getdisplayversion_fuzzer.cpp | 37 -- .../getdisplayversion_fuzzer.h | 20 - .../getdisplayversion_fuzzer/project.xml | 25 - .../getfirstapiversion_fuzzer/corpus/init | 16 - .../getfirstapiversion_fuzzer.cpp | 37 -- .../getfirstapiversion_fuzzer.h | 20 - .../getfirstapiversion_fuzzer/project.xml | 25 - .../gethardwaremodel_fuzzer/corpus/init | 16 - .../gethardwaremodel_fuzzer.cpp | 37 -- .../gethardwaremodel_fuzzer.h | 20 - .../gethardwaremodel_fuzzer/project.xml | 25 - .../gethardwareprofile_fuzzer/corpus/init | 16 - .../gethardwareprofile_fuzzer.cpp | 37 -- .../gethardwareprofile_fuzzer.h | 20 - .../gethardwareprofile_fuzzer/project.xml | 25 - .../getincrementalversion_fuzzer/corpus/init | 16 - .../getincrementalversion_fuzzer.cpp | 37 -- .../getincrementalversion_fuzzer.h | 20 - .../getincrementalversion_fuzzer/project.xml | 25 - .../fuzztest/getmarketname_fuzzer/corpus/init | 16 - .../getmarketname_fuzzer.cpp | 37 -- .../getmarketname_fuzzer.h | 20 - .../fuzztest/getmarketname_fuzzer/project.xml | 25 - .../getproductmodel_fuzzer/corpus/init | 16 - .../getproductmodel_fuzzer.cpp | 37 -- .../getproductmodel_fuzzer.h | 20 - .../getproductmodel_fuzzer/project.xml | 25 - .../getproductseries_fuzzer/corpus/init | 16 - .../getproductseries_fuzzer.cpp | 37 -- .../getproductseries_fuzzer.h | 20 - .../getproductseries_fuzzer/project.xml | 25 - test/fuzztest/getserial_fuzzer/corpus/init | 16 - .../getserial_fuzzer/getserial_fuzzer.cpp | 37 -- .../getserial_fuzzer/getserial_fuzzer.h | 20 - test/fuzztest/getserial_fuzzer/project.xml | 25 - .../getsoftwaremodel_fuzzer/corpus/init | 16 - .../getsoftwaremodel_fuzzer.cpp | 37 -- .../getsoftwaremodel_fuzzer.h | 20 - .../getsoftwaremodel_fuzzer/project.xml | 25 - .../getsystemcommitid_fuzzer/corpus/init | 16 - .../getsystemcommitid_fuzzer.cpp | 37 -- .../getsystemcommitid_fuzzer.h | 20 - .../getsystemcommitid_fuzzer/project.xml | 25 - test/fuzztest/getversionid_fuzzer/corpus/init | 16 - .../getversionid_fuzzer.cpp | 37 -- .../getversionid_fuzzer/getversionid_fuzzer.h | 20 - test/fuzztest/getversionid_fuzzer/project.xml | 25 - .../corpus/init | 16 - .../loadfstabfromcommandline_fuzzer.cpp | 37 -- .../loadfstabfromcommandline_fuzzer.h | 20 - .../project.xml | 25 - .../saveparameters_fuzzer/corpus/init | 16 - .../saveparameters_fuzzer/project.xml | 25 - .../saveparameters_fuzzer.cpp | 37 -- .../saveparameters_fuzzer.h | 20 - 78 files changed, 40 insertions(+), 2359 deletions(-) delete mode 100644 test/fuzztest/getbootslots_fuzzer/corpus/init delete mode 100644 test/fuzztest/getbootslots_fuzzer/getbootslots_fuzzer.cpp delete mode 100644 test/fuzztest/getbootslots_fuzzer/getbootslots_fuzzer.h delete mode 100644 test/fuzztest/getbootslots_fuzzer/project.xml delete mode 100644 test/fuzztest/getbrand_fuzzer/corpus/init delete mode 100644 test/fuzztest/getbrand_fuzzer/getbrand_fuzzer.cpp delete mode 100644 test/fuzztest/getbrand_fuzzer/getbrand_fuzzer.h delete mode 100644 test/fuzztest/getbrand_fuzzer/project.xml delete mode 100644 test/fuzztest/getbuildhost_fuzzer/corpus/init delete mode 100644 test/fuzztest/getbuildhost_fuzzer/getbuildhost_fuzzer.cpp delete mode 100644 test/fuzztest/getbuildhost_fuzzer/getbuildhost_fuzzer.h delete mode 100644 test/fuzztest/getbuildhost_fuzzer/project.xml delete mode 100644 test/fuzztest/getbuildversion_fuzzer/corpus/init delete mode 100644 test/fuzztest/getbuildversion_fuzzer/getbuildversion_fuzzer.cpp delete mode 100644 test/fuzztest/getbuildversion_fuzzer/getbuildversion_fuzzer.h delete mode 100644 test/fuzztest/getbuildversion_fuzzer/project.xml delete mode 100644 test/fuzztest/getdevicetypec_fuzzer/corpus/init delete mode 100644 test/fuzztest/getdevicetypec_fuzzer/getdevicetypec_fuzzer.cpp delete mode 100644 test/fuzztest/getdevicetypec_fuzzer/getdevicetypec_fuzzer.h delete mode 100644 test/fuzztest/getdevicetypec_fuzzer/project.xml delete mode 100644 test/fuzztest/getdisplayversion_fuzzer/corpus/init delete mode 100644 test/fuzztest/getdisplayversion_fuzzer/getdisplayversion_fuzzer.cpp delete mode 100644 test/fuzztest/getdisplayversion_fuzzer/getdisplayversion_fuzzer.h delete mode 100644 test/fuzztest/getdisplayversion_fuzzer/project.xml delete mode 100644 test/fuzztest/getfirstapiversion_fuzzer/corpus/init delete mode 100644 test/fuzztest/getfirstapiversion_fuzzer/getfirstapiversion_fuzzer.cpp delete mode 100644 test/fuzztest/getfirstapiversion_fuzzer/getfirstapiversion_fuzzer.h delete mode 100644 test/fuzztest/getfirstapiversion_fuzzer/project.xml delete mode 100644 test/fuzztest/gethardwaremodel_fuzzer/corpus/init delete mode 100644 test/fuzztest/gethardwaremodel_fuzzer/gethardwaremodel_fuzzer.cpp delete mode 100644 test/fuzztest/gethardwaremodel_fuzzer/gethardwaremodel_fuzzer.h delete mode 100644 test/fuzztest/gethardwaremodel_fuzzer/project.xml delete mode 100644 test/fuzztest/gethardwareprofile_fuzzer/corpus/init delete mode 100644 test/fuzztest/gethardwareprofile_fuzzer/gethardwareprofile_fuzzer.cpp delete mode 100644 test/fuzztest/gethardwareprofile_fuzzer/gethardwareprofile_fuzzer.h delete mode 100644 test/fuzztest/gethardwareprofile_fuzzer/project.xml delete mode 100644 test/fuzztest/getincrementalversion_fuzzer/corpus/init delete mode 100644 test/fuzztest/getincrementalversion_fuzzer/getincrementalversion_fuzzer.cpp delete mode 100644 test/fuzztest/getincrementalversion_fuzzer/getincrementalversion_fuzzer.h delete mode 100644 test/fuzztest/getincrementalversion_fuzzer/project.xml delete mode 100644 test/fuzztest/getmarketname_fuzzer/corpus/init delete mode 100644 test/fuzztest/getmarketname_fuzzer/getmarketname_fuzzer.cpp delete mode 100644 test/fuzztest/getmarketname_fuzzer/getmarketname_fuzzer.h delete mode 100644 test/fuzztest/getmarketname_fuzzer/project.xml delete mode 100644 test/fuzztest/getproductmodel_fuzzer/corpus/init delete mode 100644 test/fuzztest/getproductmodel_fuzzer/getproductmodel_fuzzer.cpp delete mode 100644 test/fuzztest/getproductmodel_fuzzer/getproductmodel_fuzzer.h delete mode 100644 test/fuzztest/getproductmodel_fuzzer/project.xml delete mode 100644 test/fuzztest/getproductseries_fuzzer/corpus/init delete mode 100644 test/fuzztest/getproductseries_fuzzer/getproductseries_fuzzer.cpp delete mode 100644 test/fuzztest/getproductseries_fuzzer/getproductseries_fuzzer.h delete mode 100644 test/fuzztest/getproductseries_fuzzer/project.xml delete mode 100644 test/fuzztest/getserial_fuzzer/corpus/init delete mode 100644 test/fuzztest/getserial_fuzzer/getserial_fuzzer.cpp delete mode 100644 test/fuzztest/getserial_fuzzer/getserial_fuzzer.h delete mode 100644 test/fuzztest/getserial_fuzzer/project.xml delete mode 100644 test/fuzztest/getsoftwaremodel_fuzzer/corpus/init delete mode 100644 test/fuzztest/getsoftwaremodel_fuzzer/getsoftwaremodel_fuzzer.cpp delete mode 100644 test/fuzztest/getsoftwaremodel_fuzzer/getsoftwaremodel_fuzzer.h delete mode 100644 test/fuzztest/getsoftwaremodel_fuzzer/project.xml delete mode 100644 test/fuzztest/getsystemcommitid_fuzzer/corpus/init delete mode 100644 test/fuzztest/getsystemcommitid_fuzzer/getsystemcommitid_fuzzer.cpp delete mode 100644 test/fuzztest/getsystemcommitid_fuzzer/getsystemcommitid_fuzzer.h delete mode 100644 test/fuzztest/getsystemcommitid_fuzzer/project.xml delete mode 100644 test/fuzztest/getversionid_fuzzer/corpus/init delete mode 100644 test/fuzztest/getversionid_fuzzer/getversionid_fuzzer.cpp delete mode 100644 test/fuzztest/getversionid_fuzzer/getversionid_fuzzer.h delete mode 100644 test/fuzztest/getversionid_fuzzer/project.xml delete mode 100644 test/fuzztest/loadfstabfromcommandline_fuzzer/corpus/init delete mode 100644 test/fuzztest/loadfstabfromcommandline_fuzzer/loadfstabfromcommandline_fuzzer.cpp delete mode 100644 test/fuzztest/loadfstabfromcommandline_fuzzer/loadfstabfromcommandline_fuzzer.h delete mode 100644 test/fuzztest/loadfstabfromcommandline_fuzzer/project.xml delete mode 100644 test/fuzztest/saveparameters_fuzzer/corpus/init delete mode 100644 test/fuzztest/saveparameters_fuzzer/project.xml delete mode 100644 test/fuzztest/saveparameters_fuzzer/saveparameters_fuzzer.cpp delete mode 100644 test/fuzztest/saveparameters_fuzzer/saveparameters_fuzzer.h diff --git a/test/fuzztest/BUILD.gn b/test/fuzztest/BUILD.gn index 9b8fa3a21..b21736520 100644 --- a/test/fuzztest/BUILD.gn +++ b/test/fuzztest/BUILD.gn @@ -2020,60 +2020,6 @@ ohos_fuzztest("ReceiveFdsFuzzTest") { defines = [ "STARTUP_INIT_TEST" ] } -ohos_fuzztest("LoadFstabFromCommandLineFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = - "//base/startup/init/test/fuzztest/loadfstabfromcommandline_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ - "//base/startup/init/interfaces/innerkits:libbegetutil", - "//base/startup/init/interfaces/innerkits/fs_manager:libfsmanager_static", - ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = - [ "loadfstabfromcommandline_fuzzer/loadfstabfromcommandline_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - -ohos_fuzztest("GetBootSlotsFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = "//base/startup/init/test/fuzztest/getbootslots_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ - "//base/startup/init/interfaces/innerkits:libbegetutil", - "//base/startup/init/interfaces/innerkits/fs_manager:libfsmanager_static", - ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "getbootslots_fuzzer/getbootslots_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - ohos_fuzztest("GetCurrentSlotFuzzTest") { module_out_path = module_output_path fuzz_config_file = "//base/startup/init/test/fuzztest/getcurrentslot_fuzzer" @@ -2150,29 +2096,6 @@ ohos_fuzztest("GetOSFullNameFuzzTest") { defines = [ "STARTUP_INIT_TEST" ] } -ohos_fuzztest("GetVersionIdFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = "//base/startup/init/test/fuzztest/getversionid_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "getversionid_fuzzer/getversionid_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - ohos_fuzztest("GetBuildRootHashFuzzTest") { module_out_path = module_output_path fuzz_config_file = "//base/startup/init/test/fuzztest/getbuildroothash_fuzzer" @@ -2242,29 +2165,6 @@ ohos_fuzztest("GetSdkApiVersionFuzzTest") { defines = [ "STARTUP_INIT_TEST" ] } -ohos_fuzztest("GetDeviceTypeCFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = "//base/startup/init/test/fuzztest/getdevicetypec_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "getdevicetypec_fuzzer/getdevicetypec_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - ohos_fuzztest("GetDeviceNodePermissionsFuzzTest") { module_out_path = module_output_path fuzz_config_file = @@ -2324,29 +2224,6 @@ ohos_fuzztest("GetDeviceUdevConfByDevNodeFuzzTest") { defines = [ "STARTUP_INIT_TEST" ] } -ohos_fuzztest("GetProductModelFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = "//base/startup/init/test/fuzztest/getproductmodel_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "getproductmodel_fuzzer/getproductmodel_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - ohos_fuzztest("GetManufactureFuzzTest") { module_out_path = module_output_path fuzz_config_file = "//base/startup/init/test/fuzztest/getmanufacture_fuzzer" @@ -2370,168 +2247,6 @@ ohos_fuzztest("GetManufactureFuzzTest") { defines = [ "STARTUP_INIT_TEST" ] } -ohos_fuzztest("GetBrandFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = "//base/startup/init/test/fuzztest/getbrand_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "getbrand_fuzzer/getbrand_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - -ohos_fuzztest("GetMarketNameFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = "//base/startup/init/test/fuzztest/getmarketname_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "getmarketname_fuzzer/getmarketname_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - -ohos_fuzztest("GetProductSeriesFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = "//base/startup/init/test/fuzztest/getproductseries_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "getproductseries_fuzzer/getproductseries_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - -ohos_fuzztest("GetSoftwareModelFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = "//base/startup/init/test/fuzztest/getsoftwaremodel_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "getsoftwaremodel_fuzzer/getsoftwaremodel_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - -ohos_fuzztest("GetHardwareModelFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = "//base/startup/init/test/fuzztest/gethardwaremodel_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "gethardwaremodel_fuzzer/gethardwaremodel_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - -ohos_fuzztest("GetHardwareProfileFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = - "//base/startup/init/test/fuzztest/gethardwareprofile_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "gethardwareprofile_fuzzer/gethardwareprofile_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - -ohos_fuzztest("GetSerialFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = "//base/startup/init/test/fuzztest/getserial_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "getserial_fuzzer/getserial_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - ohos_fuzztest("GetAbiListFuzzTest") { module_out_path = module_output_path fuzz_config_file = "//base/startup/init/test/fuzztest/getabilist_fuzzer" @@ -2555,54 +2270,6 @@ ohos_fuzztest("GetAbiListFuzzTest") { defines = [ "STARTUP_INIT_TEST" ] } -ohos_fuzztest("GetDisplayVersionFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = - "//base/startup/init/test/fuzztest/getdisplayversion_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "getdisplayversion_fuzzer/getdisplayversion_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - -ohos_fuzztest("GetIncrementalVersionFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = - "//base/startup/init/test/fuzztest/getincrementalversion_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "getincrementalversion_fuzzer/getincrementalversion_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - ohos_fuzztest("GetBootloaderVersionFuzzTest") { module_out_path = module_output_path fuzz_config_file = @@ -2673,29 +2340,6 @@ ohos_fuzztest("GetBuildUserFuzzTest") { defines = [ "STARTUP_INIT_TEST" ] } -ohos_fuzztest("GetBuildHostFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = "//base/startup/init/test/fuzztest/getbuildhost_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "getbuildhost_fuzzer/getbuildhost_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - ohos_fuzztest("GetBuildTimeFuzzTest") { module_out_path = module_output_path fuzz_config_file = "//base/startup/init/test/fuzztest/getbuildtime_fuzzer" @@ -2719,30 +2363,6 @@ ohos_fuzztest("GetBuildTimeFuzzTest") { defines = [ "STARTUP_INIT_TEST" ] } -ohos_fuzztest("GetFirstApiVersionFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = - "//base/startup/init/test/fuzztest/getfirstapiversion_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "getfirstapiversion_fuzzer/getfirstapiversion_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - ohos_fuzztest("AclGetSerialFuzzTest") { module_out_path = module_output_path fuzz_config_file = "//base/startup/init/test/fuzztest/aclgetserial_fuzzer" @@ -2769,53 +2389,6 @@ ohos_fuzztest("AclGetSerialFuzzTest") { defines = [ "STARTUP_INIT_TEST" ] } -ohos_fuzztest("GetSystemCommitIdFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = - "//base/startup/init/test/fuzztest/getsystemcommitid_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "getsystemcommitid_fuzzer/getsystemcommitid_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - -ohos_fuzztest("GetDeviceTypeCppFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = "//base/startup/init/test/fuzztest/getdevicetypecpp_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "getdevicetypecpp_fuzzer/getdevicetypecpp_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - ohos_fuzztest("GetMajorVersionFuzzTest") { module_out_path = module_output_path fuzz_config_file = "//base/startup/init/test/fuzztest/getmajorversion_fuzzer" @@ -3136,29 +2709,6 @@ ohos_fuzztest("ProcessWatcherMessageFuzzTest") { } } -ohos_fuzztest("GetBuildVersionFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = "//base/startup/init/test/fuzztest/getbuildversion_fuzzer" - - include_dirs = [ - "//base/startup/init/interfaces/innerkits/fd_holder", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "getbuildversion_fuzzer/getbuildversion_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - ohos_fuzztest("AclGetDevUdidFuzzTest") { module_out_path = module_output_path fuzz_config_file = "//base/startup/init/test/fuzztest/aclgetdevudid_fuzzer" @@ -3513,29 +3063,6 @@ ohos_fuzztest("RefreshWatcherFuzzTest") { } } -ohos_fuzztest("SaveParametersFuzzTest") { - module_out_path = module_output_path - fuzz_config_file = "//base/startup/init/test/fuzztest/saveparameters_fuzzer" - - include_dirs = [ - "//base/startup/init/services/include/param", - "//base/startup/init/test/fuzztest/utils/include", - ] - - deps = [ "//base/startup/init/interfaces/innerkits:libbegetutil" ] - external_deps = [ "bounds_checking_function:libsec_static" ] - external_deps += [ "hilog:libhilog" ] - - cflags = [ - "-g", - "-O0", - "-Wno-unused-variable", - "-fno-omit-frame-pointer", - ] - sources = [ "saveparameters_fuzzer/saveparameters_fuzzer.cpp" ] - defines = [ "STARTUP_INIT_TEST" ] -} - ohos_fuzztest("SystemWaitParameterFuzzTest") { module_out_path = module_output_path fuzz_config_file = @@ -3993,6 +3520,35 @@ ohos_fuzztest("AddWatcherGroupFuzzTest") { } } +ohos_fuzztest("ParamFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = + "//base/startup/init/test/fuzztest/param_fuzzer" + + include_dirs = [ + "//base/startup/init/interfaces/innerkits/fd_holder", + "//base/startup/init/test/fuzztest/utils/include", + ] + + deps = [ + "//base/startup/init/interfaces/innerkits:libbegetutil", + "//base/startup/init/interfaces/innerkits/fs_manager:libfsmanager_static", + ] + + external_deps = [ "bounds_checking_function:libsec_static" ] + external_deps += [ "hilog:libhilog" ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = + [ "param_fuzzer/param_fuzzer.cpp" ] + defines = [ "STARTUP_INIT_TEST" ] +} + ohos_fuzztest("DUMPFuzzTest") { module_out_path = module_output_path fuzz_config_file = "//base/startup/init/test/fuzztest/dump_fuzzer" @@ -4148,34 +3704,22 @@ group("fuzztest") { ":GetBlockDeviceByNameFuzzTest", ":GetBlockDevicePathFuzzTest", ":GetBoolParameterCppFuzzTest", - ":GetBootSlotsFuzzTest", ":GetBootloaderVersionFuzzTest", - ":GetBrandFuzzTest", - ":GetBuildHostFuzzTest", ":GetBuildRootHashFuzzTest", ":GetBuildTimeFuzzTest", ":GetBuildTypeFuzzTest", ":GetBuildUserFuzzTest", - ":GetBuildVersionFuzzTest", ":GetControlFileFuzzTest", ":GetControlSocketFuzzTest", ":GetCurrentSlotFuzzTest", ":GetDevUdidFuzzTest", ":GetDeviceNodePermissionsFuzzTest", - ":GetDeviceTypeCFuzzTest", - ":GetDeviceTypeCppFuzzTest", ":GetDeviceUdevConfByDevNodeFuzzTest", - ":GetDisplayVersionFuzzTest", ":GetFeatureVersionFuzzTest", - ":GetFirstApiVersionFuzzTest", - ":GetHardwareModelFuzzTest", - ":GetHardwareProfileFuzzTest", - ":GetIncrementalVersionFuzzTest", ":GetIntParameterCFuzzTest", ":GetIntParameterCppFuzzTest", ":GetMajorVersionFuzzTest", ":GetManufactureFuzzTest", - ":GetMarketNameFuzzTest", ":GetMountStatusForMountPointFuzzTest", ":GetOSFullNameFuzzTest", ":GetOsReleaseTypeFuzzTest", @@ -4185,18 +3729,12 @@ group("fuzztest") { ":GetParameterCppFuzzTest", ":GetParameterNameFuzzTest", ":GetParameterValueFuzzTest", - ":GetProductModelFuzzTest", - ":GetProductSeriesFuzzTest", ":GetSdkApiVersionFuzzTest", ":GetSecurityPatchTagFuzzTest", ":GetSeniorVersionFuzzTest", - ":GetSerialFuzzTest", ":GetServiceCtrlInfoFuzzTest", - ":GetSoftwareModelFuzzTest", ":GetStringParameterFuzzTest", - ":GetSystemCommitIdFuzzTest", ":GetUintParameterCFuzzTest", - ":GetVersionIdFuzzTest", ":HandleBlockDeviceEventFuzzTest", ":HandleOtherDeviceEventFuzzTest", ":HasSystemCapabilityFuzzTest", @@ -4211,7 +3749,6 @@ group("fuzztest") { ":InitWorkSpaceFuzzTest", ":IsSupportedFilesystemFuzzTest", ":LoadFscryptPolicyFuzzTest", - ":LoadFstabFromCommandLineFuzzTest", ":LoadParamFromCmdLineFuzzTest", ":ModuleMgrCreateFuzzTest", ":ModuleMgrDestroyFuzzTest", @@ -4261,6 +3798,7 @@ group("fuzztest") { ":WriteAllFuzzTest", ":OnRemoteDiedFuzzTest", ":OnStopFuzzTest", + ":ParamFuzzTest" ] } ############################################################################### diff --git a/test/fuzztest/getbootslots_fuzzer/corpus/init b/test/fuzztest/getbootslots_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/getbootslots_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/getbootslots_fuzzer.cpp b/test/fuzztest/getbootslots_fuzzer/getbootslots_fuzzer.cpp deleted file mode 100644 index ee1deee0f..000000000 --- a/test/fuzztest/getbootslots_fuzzer/getbootslots_fuzzer.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index 249839e96..000000000 --- a/test/fuzztest/getbootslots_fuzzer/getbootslots_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/getbootslots_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/getbootslots_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/getbrand_fuzzer/corpus/init b/test/fuzztest/getbrand_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/getbrand_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/getbrand_fuzzer.cpp b/test/fuzztest/getbrand_fuzzer/getbrand_fuzzer.cpp deleted file mode 100644 index dd98b230d..000000000 --- a/test/fuzztest/getbrand_fuzzer/getbrand_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index bba400d52..000000000 --- a/test/fuzztest/getbrand_fuzzer/getbrand_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/getbrand_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/getbrand_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/getbuildhost_fuzzer/corpus/init b/test/fuzztest/getbuildhost_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/getbuildhost_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/getbuildhost_fuzzer.cpp b/test/fuzztest/getbuildhost_fuzzer/getbuildhost_fuzzer.cpp deleted file mode 100644 index c8c8d04fd..000000000 --- a/test/fuzztest/getbuildhost_fuzzer/getbuildhost_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index a33e41236..000000000 --- a/test/fuzztest/getbuildhost_fuzzer/getbuildhost_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/getbuildhost_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/getbuildhost_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/getbuildversion_fuzzer/corpus/init b/test/fuzztest/getbuildversion_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/getbuildversion_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/getbuildversion_fuzzer.cpp b/test/fuzztest/getbuildversion_fuzzer/getbuildversion_fuzzer.cpp deleted file mode 100644 index 75c72bf3f..000000000 --- a/test/fuzztest/getbuildversion_fuzzer/getbuildversion_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index 03e6ca8e6..000000000 --- a/test/fuzztest/getbuildversion_fuzzer/getbuildversion_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/getbuildversion_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/getbuildversion_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/getdevicetypec_fuzzer/corpus/init b/test/fuzztest/getdevicetypec_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/getdevicetypec_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/getdevicetypec_fuzzer.cpp b/test/fuzztest/getdevicetypec_fuzzer/getdevicetypec_fuzzer.cpp deleted file mode 100644 index d0383126d..000000000 --- a/test/fuzztest/getdevicetypec_fuzzer/getdevicetypec_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index 7038e88be..000000000 --- a/test/fuzztest/getdevicetypec_fuzzer/getdevicetypec_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/getdevicetypec_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/getdevicetypec_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/getdevudid_fuzzer/getdevudid_fuzzer.cpp b/test/fuzztest/getdevudid_fuzzer/getdevudid_fuzzer.cpp index ecfd3995b..d312ba734 100644 --- a/test/fuzztest/getdevudid_fuzzer/getdevudid_fuzzer.cpp +++ b/test/fuzztest/getdevudid_fuzzer/getdevudid_fuzzer.cpp @@ -18,15 +18,17 @@ #include "parameter.h" namespace OHOS { - bool FuzzGetDevUdid(const uint8_t* data, size_t size) + 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; + if (size == 0) { + return false; + } + const char* udid = reinterpret_cast(data); + bool result = false; + if (!GetDevUdid(const_cast(udid), size)) { + result = true; + } + return result; } } diff --git a/test/fuzztest/getdisplayversion_fuzzer/corpus/init b/test/fuzztest/getdisplayversion_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/getdisplayversion_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/getdisplayversion_fuzzer.cpp b/test/fuzztest/getdisplayversion_fuzzer/getdisplayversion_fuzzer.cpp deleted file mode 100644 index d76ea2df4..000000000 --- a/test/fuzztest/getdisplayversion_fuzzer/getdisplayversion_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index 0fb9fac21..000000000 --- a/test/fuzztest/getdisplayversion_fuzzer/getdisplayversion_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/getdisplayversion_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/getdisplayversion_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/getfirstapiversion_fuzzer/corpus/init b/test/fuzztest/getfirstapiversion_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/getfirstapiversion_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/getfirstapiversion_fuzzer.cpp b/test/fuzztest/getfirstapiversion_fuzzer/getfirstapiversion_fuzzer.cpp deleted file mode 100644 index f022c2aab..000000000 --- a/test/fuzztest/getfirstapiversion_fuzzer/getfirstapiversion_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index 271ac6a7f..000000000 --- a/test/fuzztest/getfirstapiversion_fuzzer/getfirstapiversion_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/getfirstapiversion_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/getfirstapiversion_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/gethardwaremodel_fuzzer/corpus/init b/test/fuzztest/gethardwaremodel_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/gethardwaremodel_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/gethardwaremodel_fuzzer.cpp b/test/fuzztest/gethardwaremodel_fuzzer/gethardwaremodel_fuzzer.cpp deleted file mode 100644 index b7851fc8a..000000000 --- a/test/fuzztest/gethardwaremodel_fuzzer/gethardwaremodel_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index 81bd3e675..000000000 --- a/test/fuzztest/gethardwaremodel_fuzzer/gethardwaremodel_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/gethardwaremodel_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/gethardwaremodel_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/gethardwareprofile_fuzzer/corpus/init b/test/fuzztest/gethardwareprofile_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/gethardwareprofile_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/gethardwareprofile_fuzzer.cpp b/test/fuzztest/gethardwareprofile_fuzzer/gethardwareprofile_fuzzer.cpp deleted file mode 100644 index a299cde89..000000000 --- a/test/fuzztest/gethardwareprofile_fuzzer/gethardwareprofile_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index 33f18b91f..000000000 --- a/test/fuzztest/gethardwareprofile_fuzzer/gethardwareprofile_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/gethardwareprofile_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/gethardwareprofile_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/getincrementalversion_fuzzer/corpus/init b/test/fuzztest/getincrementalversion_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/getincrementalversion_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/getincrementalversion_fuzzer.cpp b/test/fuzztest/getincrementalversion_fuzzer/getincrementalversion_fuzzer.cpp deleted file mode 100644 index 2469c5395..000000000 --- a/test/fuzztest/getincrementalversion_fuzzer/getincrementalversion_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index 40fb3fdd3..000000000 --- a/test/fuzztest/getincrementalversion_fuzzer/getincrementalversion_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/getincrementalversion_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/getincrementalversion_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/getmarketname_fuzzer/corpus/init b/test/fuzztest/getmarketname_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/getmarketname_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/getmarketname_fuzzer.cpp b/test/fuzztest/getmarketname_fuzzer/getmarketname_fuzzer.cpp deleted file mode 100644 index 875524151..000000000 --- a/test/fuzztest/getmarketname_fuzzer/getmarketname_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index 4dbdd632a..000000000 --- a/test/fuzztest/getmarketname_fuzzer/getmarketname_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/getmarketname_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/getmarketname_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/getproductmodel_fuzzer/corpus/init b/test/fuzztest/getproductmodel_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/getproductmodel_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/getproductmodel_fuzzer.cpp b/test/fuzztest/getproductmodel_fuzzer/getproductmodel_fuzzer.cpp deleted file mode 100644 index ef72f4b90..000000000 --- a/test/fuzztest/getproductmodel_fuzzer/getproductmodel_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index 7d5d3a2f2..000000000 --- a/test/fuzztest/getproductmodel_fuzzer/getproductmodel_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/getproductmodel_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/getproductmodel_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/getproductseries_fuzzer/corpus/init b/test/fuzztest/getproductseries_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/getproductseries_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/getproductseries_fuzzer.cpp b/test/fuzztest/getproductseries_fuzzer/getproductseries_fuzzer.cpp deleted file mode 100644 index 9eb9d5cba..000000000 --- a/test/fuzztest/getproductseries_fuzzer/getproductseries_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index 3e2740b33..000000000 --- a/test/fuzztest/getproductseries_fuzzer/getproductseries_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/getproductseries_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/getproductseries_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/getserial_fuzzer/corpus/init b/test/fuzztest/getserial_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/getserial_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/getserial_fuzzer.cpp b/test/fuzztest/getserial_fuzzer/getserial_fuzzer.cpp deleted file mode 100644 index e0a7b2cf9..000000000 --- a/test/fuzztest/getserial_fuzzer/getserial_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index 5742d64bd..000000000 --- a/test/fuzztest/getserial_fuzzer/getserial_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/getserial_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/getserial_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/getsoftwaremodel_fuzzer/corpus/init b/test/fuzztest/getsoftwaremodel_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/getsoftwaremodel_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/getsoftwaremodel_fuzzer.cpp b/test/fuzztest/getsoftwaremodel_fuzzer/getsoftwaremodel_fuzzer.cpp deleted file mode 100644 index e747e054f..000000000 --- a/test/fuzztest/getsoftwaremodel_fuzzer/getsoftwaremodel_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index bdf2dcd56..000000000 --- a/test/fuzztest/getsoftwaremodel_fuzzer/getsoftwaremodel_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/getsoftwaremodel_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/getsoftwaremodel_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/getsystemcommitid_fuzzer/corpus/init b/test/fuzztest/getsystemcommitid_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/getsystemcommitid_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/getsystemcommitid_fuzzer.cpp b/test/fuzztest/getsystemcommitid_fuzzer/getsystemcommitid_fuzzer.cpp deleted file mode 100644 index 704ec840c..000000000 --- a/test/fuzztest/getsystemcommitid_fuzzer/getsystemcommitid_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index 221d4a090..000000000 --- a/test/fuzztest/getsystemcommitid_fuzzer/getsystemcommitid_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/getsystemcommitid_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/getsystemcommitid_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/getversionid_fuzzer/corpus/init b/test/fuzztest/getversionid_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/getversionid_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/getversionid_fuzzer.cpp b/test/fuzztest/getversionid_fuzzer/getversionid_fuzzer.cpp deleted file mode 100644 index 52eff04e1..000000000 --- a/test/fuzztest/getversionid_fuzzer/getversionid_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index ae0af1322..000000000 --- a/test/fuzztest/getversionid_fuzzer/getversionid_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/getversionid_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/getversionid_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/loadfstabfromcommandline_fuzzer/corpus/init b/test/fuzztest/loadfstabfromcommandline_fuzzer/corpus/init deleted file mode 100644 index 8eb5a7d6e..000000000 --- a/test/fuzztest/loadfstabfromcommandline_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/loadfstabfromcommandline_fuzzer.cpp b/test/fuzztest/loadfstabfromcommandline_fuzzer/loadfstabfromcommandline_fuzzer.cpp deleted file mode 100644 index c2d069d3d..000000000 --- a/test/fuzztest/loadfstabfromcommandline_fuzzer/loadfstabfromcommandline_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 deleted file mode 100644 index aa52134da..000000000 --- a/test/fuzztest/loadfstabfromcommandline_fuzzer/loadfstabfromcommandline_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/project.xml b/test/fuzztest/loadfstabfromcommandline_fuzzer/project.xml deleted file mode 100644 index 949d03efd..000000000 --- a/test/fuzztest/loadfstabfromcommandline_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/saveparameters_fuzzer/corpus/init b/test/fuzztest/saveparameters_fuzzer/corpus/init deleted file mode 100644 index 2b595da0c..000000000 --- a/test/fuzztest/saveparameters_fuzzer/corpus/init +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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/saveparameters_fuzzer/project.xml b/test/fuzztest/saveparameters_fuzzer/project.xml deleted file mode 100644 index a03232f21..000000000 --- a/test/fuzztest/saveparameters_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 100 - - 30 - - 2048 - - diff --git a/test/fuzztest/saveparameters_fuzzer/saveparameters_fuzzer.cpp b/test/fuzztest/saveparameters_fuzzer/saveparameters_fuzzer.cpp deleted file mode 100644 index 7149b4cfd..000000000 --- a/test/fuzztest/saveparameters_fuzzer/saveparameters_fuzzer.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 "saveparameters_fuzzer.h" -#include -#include "parameter.h" - -namespace OHOS { - bool FuzzSaveParameters(const uint8_t* data, size_t size) - { - bool result = false; - if (SaveParameters()) { - result = true; - }; - return result; - } -} - -/* Fuzzer entry point */ -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - /* Run your code on data */ - OHOS::FuzzSaveParameters(data, size); - return 0; -} diff --git a/test/fuzztest/saveparameters_fuzzer/saveparameters_fuzzer.h b/test/fuzztest/saveparameters_fuzzer/saveparameters_fuzzer.h deleted file mode 100644 index 4dd2d25d2..000000000 --- a/test/fuzztest/saveparameters_fuzzer/saveparameters_fuzzer.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 "saveparameters_fuzzer" -#endif \ No newline at end of file -- Gitee From d1a9ce50acc1cc1058101573ebb0bdd56b045687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=BE=E9=98=B3=E7=86=A0?= Date: Sat, 9 Aug 2025 11:29:58 +0000 Subject: [PATCH 2/4] =?UTF-8?q?addfuzz=20Signed-off-by:=20=E4=B9=BE?= =?UTF-8?q?=E9=98=B3=E7=86=A0=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 乾阳熠 --- test/fuzztest/param_fuzzer/corpus/init | 16 ++++++ test/fuzztest/param_fuzzer/param_fuzzer.cpp | 57 +++++++++++++++++++++ test/fuzztest/param_fuzzer/param_fuzzer.h | 20 ++++++++ test/fuzztest/param_fuzzer/project.xml | 25 +++++++++ 4 files changed, 118 insertions(+) create mode 100644 test/fuzztest/param_fuzzer/corpus/init create mode 100644 test/fuzztest/param_fuzzer/param_fuzzer.cpp create mode 100644 test/fuzztest/param_fuzzer/param_fuzzer.h create mode 100644 test/fuzztest/param_fuzzer/project.xml diff --git a/test/fuzztest/param_fuzzer/corpus/init b/test/fuzztest/param_fuzzer/corpus/init new file mode 100644 index 000000000..7ade8a0fa --- /dev/null +++ b/test/fuzztest/param_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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/param_fuzzer/param_fuzzer.cpp b/test/fuzztest/param_fuzzer/param_fuzzer.cpp new file mode 100644 index 000000000..6daa35a8d --- /dev/null +++ b/test/fuzztest/param_fuzzer/param_fuzzer.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 "param_fuzzer.h" +#include +#include "parameter.h" +#include "fs_manager/fs_manager.h" +#include "sysversion.h" + + +namespace OHOS { + bool FuzzParam(const uint8_t* data, size_t size) + { + std::string str(reinterpret_cast(data), size); + WaitParameter(str.c_str(), str.c_str(), 1); + GetBootSlots(); + GetFirstApiVersion(); + GetSerial(); + GetProductModel(); + GetIncrementalVersion(); + GetHardwareModel(); + GetBuildVersion(); + LoadFstabFromCommandLine(); + GetDeviceType(); + GetProductSeries(); + SaveParameters(); + GetDisplayVersion(); + GetHardwareProfile(); + GetBrand(); + GetBuildHost(); + GetVersionId(); + GetSoftwareModel(); + GetMarketName(); + GetSystemCommitId(); + return true; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::FuzzParam(data, size); + return 0; +} \ No newline at end of file diff --git a/test/fuzztest/param_fuzzer/param_fuzzer.h b/test/fuzztest/param_fuzzer/param_fuzzer.h new file mode 100644 index 000000000..4c5986606 --- /dev/null +++ b/test/fuzztest/param_fuzzer/param_fuzzer.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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_PARAM_FUZZER_H +#define TEST_FUZZTEST_PARAM_FUZZER_H +#include "fuzz_utils.h" +#define FUZZ_PROJECT_NAME "param_fuzzer" +#endif \ No newline at end of file diff --git a/test/fuzztest/param_fuzzer/project.xml b/test/fuzztest/param_fuzzer/project.xml new file mode 100644 index 000000000..b39473f2f --- /dev/null +++ b/test/fuzztest/param_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 100 + + 30 + + 2048 + + -- Gitee From 0ca2ac318e7391f98901e0c854d16029c04cee0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=BE=E9=98=B3=E7=86=A0?= Date: Mon, 11 Aug 2025 01:56:42 +0000 Subject: [PATCH 3/4] =?UTF-8?q?update=20test/fuzztest/getdevudid=5Ffuzzer/?= =?UTF-8?q?getdevudid=5Ffuzzer.cpp.=20Signed-off-by:=20=E4=B9=BE=E9=98=B3?= =?UTF-8?q?=E7=86=A0=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 乾阳熠 --- .../getdevudid_fuzzer/getdevudid_fuzzer.cpp | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/test/fuzztest/getdevudid_fuzzer/getdevudid_fuzzer.cpp b/test/fuzztest/getdevudid_fuzzer/getdevudid_fuzzer.cpp index d312ba734..1bdcfb488 100644 --- a/test/fuzztest/getdevudid_fuzzer/getdevudid_fuzzer.cpp +++ b/test/fuzztest/getdevudid_fuzzer/getdevudid_fuzzer.cpp @@ -16,19 +16,28 @@ #include "getdevudid_fuzzer.h" #include #include "parameter.h" +#include "securec.h" namespace OHOS { bool FuzzGetDevUdid(const uint8_t* data, size_t size) { - if (size == 0) { - return false; - } - const char* udid = reinterpret_cast(data); - bool result = false; - if (!GetDevUdid(const_cast(udid), size)) { - result = true; - } - return result; + if (data == nullptr || size == 0) { + return false; + } + char* udid = new char[size + 1]; + if (memcpy_s(udid, size, data, size) != 0) { + delete[] udid; + return false; + } + udid[size] = '\0'; + + bool result = false; + if (!GetDevUdid(udid, size)) { + result = true; + } + + delete[] udid; + return result; } } -- Gitee From fd406cd4a91beed5fdaaf575a7a9c60b65760d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=BE=E9=98=B3=E7=86=A0?= Date: Mon, 11 Aug 2025 02:32:22 +0000 Subject: [PATCH 4/4] =?UTF-8?q?update=20test/fuzztest/getdevudid=5Ffuzzer/?= =?UTF-8?q?getdevudid=5Ffuzzer.cpp.=20Signed-off-by:=20=E4=B9=BE=E9=98=B3?= =?UTF-8?q?=E7=86=A0=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 乾阳熠 --- test/fuzztest/getdevudid_fuzzer/getdevudid_fuzzer.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/fuzztest/getdevudid_fuzzer/getdevudid_fuzzer.cpp b/test/fuzztest/getdevudid_fuzzer/getdevudid_fuzzer.cpp index 1bdcfb488..f10cb28c3 100644 --- a/test/fuzztest/getdevudid_fuzzer/getdevudid_fuzzer.cpp +++ b/test/fuzztest/getdevudid_fuzzer/getdevudid_fuzzer.cpp @@ -19,18 +19,20 @@ #include "securec.h" namespace OHOS { - bool FuzzGetDevUdid(const uint8_t* data, size_t size) + bool FuzzGetDevUdid(const uint8_t* data, size_t size) { if (data == nullptr || size == 0) { return false; } - char* udid = new char[size + 1]; - if (memcpy_s(udid, size, data, size) != 0) { + char* udid = new (std::nothrow) char[size + 1]; + if (udid == nullptr) { + return false; + } + if (memcpy_s(udid, size + 1, data, size) != EOK) { delete[] udid; return false; } udid[size] = '\0'; - bool result = false; if (!GetDevUdid(udid, size)) { result = true; -- Gitee