From 4752c602059a4c169bb42e3f92eaf14f27d46833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E4=BD=B3=E4=BC=9F?= Date: Sat, 2 Aug 2025 10:42:12 +0800 Subject: [PATCH] =?UTF-8?q?Description:=E5=90=8C=E6=AD=A5=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=20IssueNo:https://gitee.com/openharmony/startup=5Fini?= =?UTF-8?q?t/issues/ICQJMF=20Binary=20Source:No=20Signed-off-by:=20songjia?= =?UTF-8?q?wei9=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/fuzztest/BUILD.gn | 51 ++++++++++++++ .../addparamentry_fuzzer.cpp | 2 +- .../addparamentry_fuzzer.h | 2 +- .../fuzztest/addparamentry_fuzzer/corpus/init | 2 +- .../fuzztest/addparamentry_fuzzer/project.xml | 2 +- .../checkappwatchpermission_fuzzer.cpp | 2 +- .../checkappwatchpermission_fuzzer.h | 2 +- .../corpus/init | 2 +- .../project.xml | 2 +- .../fuzztest/initworkspace_fuzzer/corpus/init | 2 +- .../initworkspace_fuzzer.cpp | 2 +- .../initworkspace_fuzzer.h | 2 +- .../fuzztest/initworkspace_fuzzer/project.xml | 2 +- .../mountonewithfstabfile_fuzzer/corpus/init | 2 +- .../mountonewithfstabfile_fuzzer.cpp | 2 +- .../mountonewithfstabfile_fuzzer.h | 2 +- .../mountonewithfstabfile_fuzzer/project.xml | 2 +- test/fuzztest/onstop_fuzzer/corpus/init | 2 +- test/fuzztest/onstop_fuzzer/onstop_fuzzer.cpp | 2 +- test/fuzztest/onstop_fuzzer/onstop_fuzzer.h | 2 +- test/fuzztest/onstop_fuzzer/project.xml | 2 +- .../processwatchermessage_fuzzer/corpus/init | 16 +++++ .../processwatchermessage_fuzzer.cpp | 69 +++++++++++++++++++ .../processwatchermessage_fuzzer.h | 20 ++++++ .../processwatchermessage_fuzzer/project.xml | 25 +++++++ 25 files changed, 201 insertions(+), 20 deletions(-) create mode 100644 test/fuzztest/processwatchermessage_fuzzer/corpus/init create mode 100644 test/fuzztest/processwatchermessage_fuzzer/processwatchermessage_fuzzer.cpp create mode 100644 test/fuzztest/processwatchermessage_fuzzer/processwatchermessage_fuzzer.h create mode 100644 test/fuzztest/processwatchermessage_fuzzer/project.xml diff --git a/test/fuzztest/BUILD.gn b/test/fuzztest/BUILD.gn index 7d9ac4bb5..9b8fa3a21 100644 --- a/test/fuzztest/BUILD.gn +++ b/test/fuzztest/BUILD.gn @@ -3086,6 +3086,56 @@ ohos_fuzztest("OnStopFuzzTest") { } } +ohos_fuzztest("ProcessWatcherMessageFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//base/startup/init/test/fuzztest/processwatchermessage_fuzzer" + + sources = [ + "//base/startup/init/services/param/linux/param_message.c", + "//base/startup/init/services/param/watcher/proxy/watcher_manager.cpp", + ] + include_dirs = [ + "//base/startup/init/interfaces/innerkits/include", + "//base/startup/init/test/fuzztest/utils/include", + "//base/startup/init/services/param/watcher/proxy", + "//base/startup/init/services/param/watcher/include", + "//base/startup/init/services/param/include", + "//base/startup/init/interfaces/innerkits/include/param", + "//base/startup/init/services/param/linux", + "//base/startup/init/services/loopevent/include", + "//base/startup/init/services/param/watcher/agent", + ] + + deps = [ + "//base/startup/init/interfaces/innerkits:libbegetutil", + "//base/startup/init/interfaces/innerkits/:param_watcher_stub", + "//base/startup/init/services/log:agent_log", + ] + external_deps = [ + "bounds_checking_function:libsec_static", + "c_utils:utils", + "hilog:libhilog", + "ipc:ipc_single", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + ] + if (init_paramwatcher_hicollie_enable) { + external_deps += [ "hicollie:libhicollie" ] + } + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources += [ "processwatchermessage_fuzzer/processwatchermessage_fuzzer.cpp" ] + defines = [ "STARTUP_INIT_TEST" ] + if (init_paramwatcher_hicollie_enable) { + defines += [ "HICOLLIE_ENABLE" ] + } +} + ohos_fuzztest("GetBuildVersionFuzzTest") { module_out_path = module_output_path fuzz_config_file = "//base/startup/init/test/fuzztest/getbuildversion_fuzzer" @@ -4177,6 +4227,7 @@ group("fuzztest") { ":ParseFstabPerLineFuzzTest", ":ParseUeventConfigFuzzTest", ":ParseUeventdConfigFileFuzzTest", + ":ProcessWatcherMessageFuzzTest", ":ReadFileInDirFuzzTest", ":ReadFileToBufFuzzTest", ":ReadFstabFromFileFuzzTest", diff --git a/test/fuzztest/addparamentry_fuzzer/addparamentry_fuzzer.cpp b/test/fuzztest/addparamentry_fuzzer/addparamentry_fuzzer.cpp index 700afbbb3..9a9400ef5 100644 --- a/test/fuzztest/addparamentry_fuzzer/addparamentry_fuzzer.cpp +++ b/test/fuzztest/addparamentry_fuzzer/addparamentry_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * 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 diff --git a/test/fuzztest/addparamentry_fuzzer/addparamentry_fuzzer.h b/test/fuzztest/addparamentry_fuzzer/addparamentry_fuzzer.h index 72d69b470..69b165b36 100644 --- a/test/fuzztest/addparamentry_fuzzer/addparamentry_fuzzer.h +++ b/test/fuzztest/addparamentry_fuzzer/addparamentry_fuzzer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 diff --git a/test/fuzztest/addparamentry_fuzzer/corpus/init b/test/fuzztest/addparamentry_fuzzer/corpus/init index 8eb5a7d6e..7ade8a0fa 100644 --- a/test/fuzztest/addparamentry_fuzzer/corpus/init +++ b/test/fuzztest/addparamentry_fuzzer/corpus/init @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 diff --git a/test/fuzztest/addparamentry_fuzzer/project.xml b/test/fuzztest/addparamentry_fuzzer/project.xml index 949d03efd..b39473f2f 100644 --- a/test/fuzztest/addparamentry_fuzzer/project.xml +++ b/test/fuzztest/addparamentry_fuzzer/project.xml @@ -1,5 +1,5 @@ - + + + + 100 + + 30 + + 3072 + + \ No newline at end of file -- Gitee