mirror of
https://github.com/openharmony/startup_init_lite.git
synced 2026-07-01 03:23:16 -04:00
@@ -147,6 +147,48 @@ ohos_fuzztest("ReadFileInDirFuzzTest") {
|
||||
defines = [ "STARTUP_INIT_TEST" ]
|
||||
}
|
||||
|
||||
ohos_fuzztest("ServiceControlStartFuzzTest") {
|
||||
module_out_path = module_output_path
|
||||
|
||||
include_dirs = [ "//base/startup/init_lite/interfaces/innerkits/include" ]
|
||||
deps = [
|
||||
"//base/startup/init_lite/interfaces/innerkits:libbegetutil",
|
||||
"//base/startup/init_lite/services/param:param_client",
|
||||
]
|
||||
external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
|
||||
|
||||
cflags = [
|
||||
"-g",
|
||||
"-O0",
|
||||
"-Wno-unused-variable",
|
||||
"-fno-omit-frame-pointer",
|
||||
]
|
||||
sources = [ "ServiceControlStart_fuzzer/ServiceControlStart_fuzzer.cpp" ]
|
||||
|
||||
defines = [ "STARTUP_INIT_TEST" ]
|
||||
}
|
||||
|
||||
ohos_fuzztest("ServiceControlStopFuzzTest") {
|
||||
module_out_path = module_output_path
|
||||
|
||||
include_dirs = [ "//base/startup/init_lite/interfaces/innerkits/include" ]
|
||||
deps = [
|
||||
"//base/startup/init_lite/interfaces/innerkits:libbegetutil",
|
||||
"//base/startup/init_lite/services/param:param_client",
|
||||
]
|
||||
external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
|
||||
|
||||
cflags = [
|
||||
"-g",
|
||||
"-O0",
|
||||
"-Wno-unused-variable",
|
||||
"-fno-omit-frame-pointer",
|
||||
]
|
||||
sources = [ "ServiceControlStop_fuzzer/ServiceControlStop_fuzzer.cpp" ]
|
||||
|
||||
defines = [ "STARTUP_INIT_TEST" ]
|
||||
}
|
||||
|
||||
ohos_fuzztest("SystemDumpParametersFuzzTest") {
|
||||
module_out_path = module_output_path
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT 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 "ServiceControlStart_fuzzer.h"
|
||||
#include "service_control.h"
|
||||
|
||||
namespace OHOS {
|
||||
bool FuzzServiceControlStart(const uint8_t* data, size_t size)
|
||||
{
|
||||
bool result = false;
|
||||
if (!ServiceControl(reinterpret_cast<const char*>(data)), START) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fuzzer entry point */
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
/* Run your code on data */
|
||||
OHOS::FuzzServiceControlStart(data, size);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT 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_STARTDYNAMICPROCESS_FUZZER_H
|
||||
#define TEST_FUZZTEST_STARTDYNAMICPROCESS_FUZZER_H
|
||||
#define FUZZ_PROJECT_NAME "ServiceControlStart_fuzzer"
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT 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 "ServiceControlStop_fuzzer.h"
|
||||
#include "service_control.h"
|
||||
|
||||
namespace OHOS {
|
||||
bool FuzzServiceControlStop(const uint8_t* data, size_t size)
|
||||
{
|
||||
bool result = false;
|
||||
if (!ServiceControl(reinterpret_cast<const char*>(data)), STOP) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fuzzer entry point */
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
/* Run your code on data */
|
||||
OHOS::FuzzServiceControlStop(data, size);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT 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_STOPDYNAMICPROCESS_FUZZER_H
|
||||
#define TEST_FUZZTEST_STOPDYNAMICPROCESS_FUZZER_H
|
||||
#define FUZZ_PROJECT_NAME "ServiceControlStop_fuzzer"
|
||||
#endif
|
||||
Reference in New Issue
Block a user