提交 38ea9915 编写于 作者: 蔡明港 提交者: Gitee

Merge branch 'master' of gitee.com:openharmony/startup_init_lite into master

Signed-off-by: N蔡明港 <caiminggang1@huawei.com>
#
# Copyright (c) 2020-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
static_library("hal_sys_param") {
sources = [ "hal_sys_param.c" ]
include_dirs = [ "//base/startup/init/interfaces/hals" ]
defines = [
"INCREMENTAL_VERSION=\"${ohos_version}\"",
"BUILD_TYPE=\"${ohos_build_type}\"",
"BUILD_USER=\"${ohos_build_user}\"",
"BUILD_TIME=\"${ohos_build_time}\"",
"BUILD_HOST=\"${ohos_build_host}\"",
"BUILD_ROOTHASH=\"${ohos_build_roothash}\"",
]
}
/*
* Copyright (c) 2020-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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 "hal_sys_param.h"
static const char OHOS_ABI_LIST[] = {"****"};
static const char OHOS_BOOTLOADER_VERSION[] = {"bootloader"};
static const char OHOS_BRAND[] = {"****"};
static const char OHOS_DEVICE_TYPE[] = {"****"};
static const char OHOS_DISPLAY_VERSION[] = {"OpenHarmony 3.1"};
static const char OHOS_HARDWARE_MODEL[] = {"****"};
static const char OHOS_HARDWARE_PROFILE[] = {"aout:true,display:true"};
static const char OHOS_MARKET_NAME[] = {"****"};
static const char OHOS_MANUFACTURE[] = {"****"};
static const char OHOS_PRODUCT_MODEL[] = {"****"};
static const char OHOS_PRODUCT_SERIES[] = {"****"};
static const char OHOS_SERIAL[] = {"****"}; // provided by OEM.
static const char OHOS_SOFTWARE_MODEL[] = {"****"};
static const int OHOS_FIRST_API_VERSION = 1;
__attribute__((weak)) const char* HalGetDeviceType(void)
{
return OHOS_DEVICE_TYPE;
}
__attribute__((weak)) const char* HalGetManufacture(void)
{
return OHOS_MANUFACTURE;
}
__attribute__((weak)) const char* HalGetBrand(void)
{
return OHOS_BRAND;
}
__attribute__((weak)) const char* HalGetMarketName(void)
{
return OHOS_MARKET_NAME;
}
__attribute__((weak)) const char* HalGetProductSeries(void)
{
return OHOS_PRODUCT_SERIES;
}
__attribute__((weak)) const char* HalGetProductModel(void)
{
return OHOS_PRODUCT_MODEL;
}
__attribute__((weak)) const char* HalGetSoftwareModel(void)
{
return OHOS_SOFTWARE_MODEL;
}
__attribute__((weak)) const char* HalGetHardwareModel(void)
{
return OHOS_HARDWARE_MODEL;
}
__attribute__((weak)) const char* HalGetHardwareProfile(void)
{
return OHOS_HARDWARE_PROFILE;
}
__attribute__((weak)) const char* HalGetSerial(void)
{
return OHOS_SERIAL;
}
__attribute__((weak)) const char* HalGetBootloaderVersion(void)
{
return OHOS_BOOTLOADER_VERSION;
}
__attribute__((weak)) const char* HalGetAbiList(void)
{
return OHOS_ABI_LIST;
}
__attribute__((weak)) const char* HalGetDisplayVersion(void)
{
return OHOS_DISPLAY_VERSION;
}
__attribute__((weak)) const char* HalGetIncrementalVersion(void)
{
return INCREMENTAL_VERSION;
}
__attribute__((weak)) const char* HalGetBuildType(void)
{
return BUILD_TYPE;
}
__attribute__((weak)) const char* HalGetBuildUser(void)
{
return BUILD_USER;
}
__attribute__((weak)) const char* HalGetBuildHost(void)
{
return BUILD_HOST;
}
__attribute__((weak)) const char* HalGetBuildTime(void)
{
return BUILD_TIME;
}
__attribute__((weak)) int HalGetFirstApiVersion(void)
{
return OHOS_FIRST_API_VERSION;
}
\ No newline at end of file
#
# Copyright (c) 2020-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
static_library("static_hal_token") {
sources = [ "hal_token.c" ]
include_dirs = [
"//base/startup/init/interfaces/hals",
"//commonlibrary/utils_lite/include",
]
deps = []
}
/*
* Copyright (c) 2020-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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 "hal_token.h"
#include "ohos_errno.h"
#include "ohos_types.h"
__attribute__((weak)) static int OEMReadToken(char* token, unsigned int len)
{
// OEM need add here, read token from device
(void)(token);
(void)(len);
return EC_SUCCESS;
}
__attribute__((weak)) static int OEMWriteToken(const char* token, unsigned int len)
{
// OEM need add here, write token to device
(void)(token);
(void)(len);
return EC_SUCCESS;
}
__attribute__((weak)) static int OEMGetAcKey(char* acKey, unsigned int len)
{
// OEM need add here, get AcKey
(void)(acKey);
(void)(len);
return EC_SUCCESS;
}
__attribute__((weak)) static int OEMGetProdId(char* productId, unsigned int len)
{
// OEM need add here, get ProdId
(void)(productId);
(void)(len);
return EC_SUCCESS;
}
__attribute__((weak)) static int OEMGetProdKey(char* productKey, unsigned int len)
{
// OEM need add here, get ProdKey
(void)(productKey);
(void)(len);
return EC_SUCCESS;
}
__attribute__((weak)) int HalReadToken(char* token, unsigned int len)
{
if (token == NULL) {
return EC_FAILURE;
}
return OEMReadToken(token, len);
}
__attribute__((weak)) int HalWriteToken(const char* token, unsigned int len)
{
if (token == NULL) {
return EC_FAILURE;
}
return OEMWriteToken(token, len);
}
__attribute__((weak)) int HalGetAcKey(char* acKey, unsigned int len)
{
if (acKey == NULL) {
return EC_FAILURE;
}
return OEMGetAcKey(acKey, len);
}
__attribute__((weak)) int HalGetProdId(char* productId, unsigned int len)
{
if (productId == NULL) {
return EC_FAILURE;
}
return OEMGetProdId(productId, len);
}
__attribute__((weak)) int HalGetProdKey(char* productKey, unsigned int len)
{
if (productKey == NULL) {
return EC_FAILURE;
}
return OEMGetProdKey(productKey, len);
}
\ No newline at end of file
......@@ -109,7 +109,17 @@ if (defined(ohos_lite)) {
sources = []
if (enable_ohos_startup_init_feature_begetctl_liteos) {
deps += [ "$ohos_product_adapter_dir/utils/sys_param:hal_sysparam" ]
PRODUCT_HAL_SYSPARAM_PATH =
rebase_path("//${ohos_product_adapter_dir}/utils/sys_param")
cmd = "if [ -f ${PRODUCT_HAL_SYSPARAM_PATH}/BUILD.gn ]; then echo true; else echo false; fi"
PRODUCT_HAL_SYSPARAM_EXISTS =
exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
if (PRODUCT_HAL_SYSPARAM_EXISTS) {
deps += [ "$ohos_product_adapter_dir/utils/sys_param:hal_sysparam" ]
}
deps += [
"//base/startup/init/interfaces/hals/utils/sys_param:hal_sys_param",
]
defines += [ "LITEOS_SUPPORT" ]
sources += syspara_sources
} else {
......
......@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <fcntl.h>
#include <unistd.h>
......
......@@ -34,6 +34,8 @@ int SystemWriteParam(const char *name, const char *value);
int SystemReadParam(const char *name, char *value, unsigned int *len);
int LoadParamsFile(const char *fileName, bool onlyAdd);
typedef int (*CmdExecutor)(int id, const char *name, int argc, const char **argv);
int AddCmdExecutor(const char *cmdName, CmdExecutor execCmd);
......
[
{ "name": "SystemWriteParam" },
{ "name": "SystemReadParam" },
{ "name": "LoadParamsFile" },
{ "name": "SplitString" },
{ "name": "AddCmdExecutor" },
{ "name": "RemoveCmdExecutor" },
......
......@@ -44,8 +44,16 @@ if (ohos_kernel_type == "liteos_m") {
"//base/startup/init/interfaces/innerkits/token",
"//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite",
]
deps = [ "$ohos_product_adapter_dir/utils/token:hal_token_static" ]
PRODUCT_HAL_TOKEN_PATH =
rebase_path("//${ohos_product_adapter_dir}/utils/token")
cmd = "if [ -f ${PRODUCT_HAL_TOKEN_PATH}/BUILD.gn ]; then echo true; else echo false; fi"
PRODUCT_HAL_TOKEN_EXISTS =
exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
if (PRODUCT_HAL_TOKEN_EXISTS) {
deps += [ "$ohos_product_adapter_dir/utils/token:hal_token_static" ]
}
deps +=
[ "//base/startup/init/interfaces/hals/utils/token:static_hal_token" ]
}
}
......
......@@ -29,10 +29,10 @@ shared_relro:x:1037:
audio:x:1041:
cameraserver:x:1047:
uiserver:x:1048:
servicectrl:x:1050:root,shell,system,samgr,hdf_devmgr
servicectrl:x:1050:root,shell,system,samgr,hdf_devmgr,foundation
powerctrl:x:1051:root,shell,system,update,power_host
bootctrl:x:1052:root,shell,system
deviceprivate:x:1053:root,shell,system,samgr,hdf_devmgr,deviceinfo,dsoftbus,dms,account,useriam,access_token,device_manager,foundation,dbms,deviceauth,huks_server,dlp_credential,edm
deviceprivate:x:1053:root,shell,system,samgr,hdf_devmgr,deviceinfo,dsoftbus,dms,account,useriam,access_token,device_manager,foundation,dbms,deviceauth,huks_server,dlp_credential,dsserver,edm
hiview:x:1201:
hidumper_service:x:1212:
shell:x:2000:
......@@ -120,3 +120,4 @@ ispserver:x:3821:
dfs_share:x:3822:
appspawn:x:4000:
security_guard:x:3520:
dsserver:x:3068:
\ No newline at end of file
......@@ -118,7 +118,6 @@
"mkdir /data/service/el1 0711 root root",
"mkdir /data/service/el1/public 0711 root root",
"mkdir /data/service/el1/public/AbilityManagerService 0711 system system",
"mkdir /data/service/el1/public/access_token 0770 access_token access_token",
"mkdir /data/service/el2 0711 root root",
"mkdir /data/chipset 0711 root root",
"mkdir /data/chipset/el1 0711 root root",
......
......@@ -105,7 +105,6 @@
"mkdir /data/app/el4 0711 root root",
"mkdir /data/service/el1 0711 root root",
"mkdir /data/service/el1/public 0711 root root",
"mkdir /data/service/el1/public/access_token 0770 access_token access_token",
"mkdir /data/service/el2 0711 root root",
"mkdir /data/chipset 0711 root root",
"mkdir /data/chipset/el1 0711 root root",
......
......@@ -18,16 +18,7 @@ startup_param=40960
persist_param=40960
const_param=40960
persist_sys_param=4096
hw_sc_param=4096
hw_sc_build_os_param=4096
init_param=4096
init_svc_param=4096
const_postinstall_param=4096
const_postinstall_fstab_param=4096
const_allow_param=4096
const_allow_mock_param=4096
devinfo_public_param=30720
security_param=4096
sys_param=4096
bootevent_param=4096
startup_init_param=40960
......@@ -116,3 +116,4 @@ memmgr:x:1111:1111:::/bin/false
ispserver:x:3821:3821:::/bin/false
dfs_share:x:3822:3822:::/bin/false
security_guard:x:3520:3520:::/bin/false
dsserver:x:3068:3068:::/bin/false
......@@ -244,7 +244,9 @@ void CloseServiceSocket(Service *service)
sockopt->sockFd = -1;
}
if (GetSocketAddr(&addr, sockopt->name) == 0) {
#ifndef STARTUP_INIT_TEST
unlink(addr.sun_path);
#endif
}
sockopt = sockopt->next;
}
......
......@@ -162,6 +162,13 @@ cacheflush
set_tls
sched_setscheduler
mkdir
setitimer
execve
sched_getscheduler
fstatfs
setsid
rt_tgsigqueueinfo
ptrace
@allowListWithArgs
getrusage:if arg0 == RUSAGE_SELF || arg0 == RUSAGE_THREAD; return ALLOW; else return KILL_PROCESS;
......
......@@ -131,6 +131,13 @@ getrandom
statx
prlimit64
sched_setscheduler
setitimer
execve
sched_getscheduler
fstatfs
setsid
rt_tgsigqueueinfo
ptrace
@allowListWithArgs
getrusage:if arg0 == RUSAGE_SELF || arg0 == RUSAGE_THREAD; return ALLOW; else return KILL_PROCESS;
......
......@@ -266,9 +266,6 @@ static int DacCheckParamPermission(const ParamSecurityLabel *srcLabel, const cha
if (ret != DAC_RESULT_PERMISSION) {
PARAM_LOGW("Param '%s' label gid:%d uid:%d mode 0%o", name, srcLabel->cred.gid, srcLabel->cred.uid, localMode);
PARAM_LOGW("Cfg label %d gid:%d uid:%d mode 0%o ", labelIndex, node->gid, node->uid, node->mode);
#ifndef STARTUP_INIT_TEST
ret = DAC_RESULT_PERMISSION;
#endif
}
return ret;
}
......
......@@ -45,7 +45,15 @@ extern "C" {
#endif
#define PARAM_WORKSPACE_INVALID ((uint32_t)-1)
#define PARAM_WORKSPACE_MIN (4096)
#define PARAM_WORKSPACE_MIN (1024)
/*
length for parameter = node size + data size
xxxx.xxxx.xxxx.xxxx
node size:
24 * (count(.) + 1) + strlen(xxxx.xxxx.xxxx.xxxx)
data size
strlen(xxxx.xxxx.xxxx.xxxx) + 96
*/
#if (defined __LITEOS_A__ || defined __LITEOS_M__)
#define DAC_DEFAULT_MODE 0777
#ifdef STARTUP_INIT_TEST
......
......@@ -39,7 +39,7 @@ __attribute__((constructor)) static void ParameterInit(void)
if (getpid() == 1) {
return;
}
EnableInitLog(INIT_ERROR);
EnableInitLog(INIT_INFO);
PARAM_WORKSPACE_OPS ops = {0};
ops.updaterMode = 0;
#ifdef PARAM_BASE_LOG
......
......@@ -192,6 +192,11 @@ static int ProcessParamFile(const char *fileName, void *context)
return LoadDefaultParam_(fileName, mode, exclude, ARRAY_LENGTH(exclude), LoadOneParam_);
}
int LoadParamsFile(const char *fileName, bool onlyAdd)
{
return LoadDefaultParams(fileName, onlyAdd ? LOAD_PARAM_ONLY_ADD : LOAD_PARAM_NORMAL);
}
int LoadDefaultParams(const char *fileName, uint32_t mode)
{
PARAM_CHECK(fileName != NULL, return -1, "Invalid filename for load");
......
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "AclGetDevUdid_fuzzer.h"
#include <string>
#include "parameter.h"
namespace OHOS {
bool FuzzAclGetDevUdid(const uint8_t* data, size_t size)
{
bool result = false;
char udid[65] = {0};
int len = sizeof(udid);
if (!AclGetDevUdid(udid, len)) {
result = true;
};
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzAclGetDevUdid(data, size);
return 0;
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_FUZZTEST_ACL_GET_DEV_UDID_FUZZER_H
#define TEST_FUZZTEST_ACL_GET_DEV_UDID_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "AclGetDevUdid_fuzzer"
#endif
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2021-2022 Huawei Device Co., Ltd.
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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 "AclGetSerial_fuzzer.h"
#include <string>
#include "parameter.h"
namespace OHOS {
bool FuzzAclGetSerial(const uint8_t* data, size_t size)
{
bool result = false;
if (AclGetSerial() != 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::FuzzAclGetSerial(data, size);
return 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_ACL_GET_SERIAL_H
#define TEST_FUZZTEST_ACL_GET_SERIAL_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "AclGetSerial_fuzzer"
#endif
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2021-2022 Huawei Device Co., Ltd.
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......
此差异已折叠。
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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 <string>
#include "fd_holder_internal.h"
#include "BuildControlMessage_fuzzer.h"
namespace OHOS {
bool FuzzBuildControlMessage(const uint8_t* data, size_t size)
{
bool result = false;
if (!BuildControlMessage(nullptr, nullptr, 1, false)) {
result = true;
}
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzBuildControlMessage(data, size);
return 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_BUILD_CONTROL_MESSAGE_H
#define TEST_FUZZTEST_BUILD_CONTROL_MESSAGE_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "BuildControlMessage_fuzzer"
#endif
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2021-2022 Huawei Device Co., Ltd.
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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 "CmdClientInit_fuzzer.h"
#include <string>
#include "control_fd.h"
namespace OHOS {
bool FuzzCmdClientInit(const uint8_t* data, size_t size)
{
std::string str(reinterpret_cast<const char*>(data), size);
CmdClientInit(str.c_str(), 1, str.c_str());
return true;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzCmdClientInit(data, size);
return 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_CMD_CLIENT_INIT_FUZZER_H
#define TEST_FUZZTEST_CMD_CLIENT_INIT_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "CmdClientInit_fuzzer"
#endif
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2021-2022 Huawei Device Co., Ltd.
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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 "CmdServiceInit_fuzzer.h"
#include <string>
#include "fuzz_utils.h"
#include "control_fd.h"
static void Func(uint16_t type, const char *serviceCmd, const void *context)
{
printf("type is:%d, serviceCmd is:%s\n", type, serviceCmd);
}
namespace OHOS {
bool FuzzCmdServiceInit(const uint8_t* data, size_t size)
{
std::string str(reinterpret_cast<const char*>(data), size);
CloseStdout();
CmdServiceInit(str.c_str(), Func);
return true;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzCmdServiceInit(data, size);
return 0;
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_FUZZTEST_CMD_SERVICE_INIT_FUZZER_H
#define TEST_FUZZTEST_CMD_SERVICE_INIT_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "CmdServiceInit_fuzzer"
#endif
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "CmdServiceProcessDelClient_fuzzer.h"
#include <string>
#include "control_fd.h"
namespace OHOS {
bool FuzzCmdServiceProcessDelClient(const uint8_t* data, size_t size)
{
CmdServiceProcessDelClient(1);
return true;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzCmdServiceProcessDelClient(data, size);
return 0;
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_FUZZTEST_CMD_SERVICE_PROCESS_DEL_CLIENT_FUZZER_H
#define TEST_FUZZTEST_CMD_SERVICE_PROCESS_DEL_CLIENT_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "CmdServiceProcessDelClient_fuzzer"
#endif
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "DoFormat_fuzzer.h"
#include <iostream>
#include <string>
#include "fs_manager/fs_manager.h"
namespace OHOS {
bool FuzzDoFormat(const uint8_t* data, size_t size)
{
bool resule = false;
std::string str(reinterpret_cast<const char*>(data), size);
if (!DoFormat(str.c_str(), str.c_str())) {
resule = true;
};
return resule;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzDoFormat(data, size);
return 0;
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_FUZZTEST_DO_FORMAT_FUZZER_H
#define TEST_FUZZTEST_DO_FORMAT_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "DoFormat_fuzzer"
#endif
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "FindFstabItemForMountPoint_fuzzer.h"
#include <iostream>
#include <string>
#include "fs_manager/fs_manager.h"
namespace OHOS {
bool FuzzFindFstabItemForMountPoint(const uint8_t* data, size_t size)
{
bool result = false;
FILE *pFile = nullptr;
pFile = fopen("fstab.test", "w+");
if (pFile == nullptr) {
std::cout << "[fuzz] open file fstab.test failed";
return false;
}
if (fwrite(data, 1, size, pFile) != size) {
std::cout << "[fuzz] write data to fstab.test failed";
(void)fclose(pFile);
return false;
}
(void)fclose(pFile);
CloseStdout();
Fstab *fstab = ReadFstabFromFile("fstab.test", false);
std::string str(reinterpret_cast<const char*>(data), size);
if (FindFstabItemForMountPoint(*fstab, str.c_str()) != nullptr) {
result = true;
};
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzFindFstabItemForMountPoint(data, size);
return 0;
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_FUZZTEST_FIND_FSTAB_ITEM_FOR_MOUNT_POINT_FUZZER_H
#define TEST_FUZZTEST_FIND_FSTAB_ITEM_FOR_MOUNT_POINT_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "FindFstabItemForMountPoint_fuzzer"
#endif
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "FindFstabItemForPath_fuzzer.h"
#include <iostream>
#include <string>
#include "fs_manager/fs_manager.h"
namespace OHOS {
bool FuzzFindFstabItemForPath(const uint8_t* data, size_t size)
{
bool result = false;
FILE *pFile = nullptr;
pFile = fopen("fstab.test", "w+");
if (pFile == nullptr) {
std::cout << "[fuzz] open file fstab.test failed";
return false;
}
if (fwrite(data, 1, size, pFile) != size) {
std::cout << "[fuzz] write data to fstab.test failed";
(void)fclose(pFile);
return false;
}
(void)fclose(pFile);
CloseStdout();
Fstab *fstab = ReadFstabFromFile("fstab.test", false);
std::string str(reinterpret_cast<const char*>(data), size);
if (FindFstabItemForPath(*fstab, str.c_str()) != nullptr) {
result = true;
};
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzFindFstabItemForPath(data, size);
return 0;
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_FUZZTEST_FIND_FSTAB_ITEM_FOR_PATH_FUZZER_H
#define TEST_FUZZTEST_FIND_FSTAB_ITEM_FOR_PATH_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "FindFstabItemForPath_fuzzer"
#endif
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......@@ -13,18 +13,16 @@
* limitations under the License.
*/
#include "systemfindparameter_fuzzer.h"
#include "FindParameter_fuzzer.h"
#include<string>
#include "init_param.h"
static ParamHandle handle;
#include "parameter.h"
namespace OHOS {
bool FuzzSystemFindParameter(const uint8_t* data, size_t size)
bool FuzzFindParameter(const uint8_t* data, size_t size)
{
bool result = false;
std::string str(reinterpret_cast<const char*>(data), size);
if (!SystemFindParameter(str.c_str(), &handle)) {
if (!FindParameter(str.c_str())) {
result = true;
}
return result;
......@@ -35,6 +33,6 @@ namespace OHOS {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzSystemFindParameter(data, size);
OHOS::FuzzFindParameter(data, size);
return 0;
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_FUZZTEST_FINDPARAMETER_FUZZER_H
#define TEST_FUZZTEST_FINDPARAMETER_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "FindParameter_fuzzer"
#endif
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "GetAbiList_fuzzer.h"
#include <string>
#include "parameter.h"
namespace OHOS {
bool FuzzGetAbiList(const uint8_t* data, size_t size)
{
bool result = false;
if (GetAbiList() != nullptr) {
result = true;
};
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzGetAbiList(data, size);
return 0;
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_FUZZTEST_GET_ABILIST_H
#define TEST_FUZZTEST_GET_ABILIST_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "GetAbiList_fuzzer"
#endif
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "GetBlockDeviceByMountPoint_fuzzer.h"
#include <iostream>
#include "fs_manager/fs_manager.h"
namespace OHOS {
bool FuzzGetBlockDeviceByMountPoint(const uint8_t* data, size_t size)
{
bool result = false;
FILE *pFile = nullptr;
pFile = fopen("fstab.test", "w+");
if (pFile == nullptr) {
std::cout << "[fuzz] open file fstab.test failed";
return false;
}
if (fwrite(data, 1, size, pFile) != size) {
std::cout << "[fuzz] write data to fstab.test failed";
(void)fclose(pFile);
return false;
}
(void)fclose(pFile);
CloseStdout();
const Fstab *fstab = ReadFstabFromFile("fstab.test", false);
std::string str(reinterpret_cast<const char*>(data), size);
char deviceName[100] = {0};
int length = sizeof(deviceName);
if (!GetBlockDeviceByMountPoint(str.c_str(), fstab, deviceName, length)) {
result = true;
}
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzGetBlockDeviceByMountPoint(data, size);
return 0;
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_FUZZTEST_GET_BLOCK_DEVICE_BY_MOUNT_POINT_FUZZER_H
#define TEST_FUZZTEST_GET_BLOCK_DEVICE_BY_MOUNT_POINT_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "GetBlockDeviceByMountPoint_fuzzer"
#endif
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "GetBlockDeviceByName_fuzzer.h"
#include <iostream>
#include <string>
#include "fs_manager/fs_manager.h"
namespace OHOS {
bool FuzzGetBlockDeviceByName(const uint8_t* data, size_t size)
{
bool result = false;
FILE *pFile = nullptr;
pFile = fopen("fstab.test", "w+");
if (pFile == nullptr) {
std::cout << "[fuzz] open file fstab.test failed";
return false;
}
if (fwrite(data, 1, size, pFile) != size) {
std::cout << "[fuzz] write data to fstab.test failed";
(void)fclose(pFile);
return false;
}
(void)fclose(pFile);
CloseStdout();
const Fstab *fstab = ReadFstabFromFile("fstab.test", false);
std::string str(reinterpret_cast<const char*>(data), size);
char miscDev[1024] = {0};
size_t len = sizeof(miscDev);
if (GetBlockDeviceByName(str.c_str(), fstab, miscDev, len)) {
result = true;
};
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzGetBlockDeviceByName(data, size);
return 0;
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_FUZZTEST_GET_BLOCK_DEVICE_NAME_FUZZER_H
#define TEST_FUZZTEST_GET_BLOCK_DEVICE_NAME_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "GetBlockDeviceByName_fuzzer"
#endif
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "GetBlockDevicePath_fuzzer.h"
#include <string>
#include "fs_manager/fs_manager.h"
namespace OHOS {
bool FuzzGetBlockDevicePath(const uint8_t* data, size_t size)
{
bool result = false;
std::string str(reinterpret_cast<const char*>(data), size);
if (!GetBlockDevicePath(str.c_str(), nullptr, size)) {
result = true;
}
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzGetBlockDevicePath(data, size);
return 0;
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_FUZZTEST_GET_BLOCK_DEVICE_PATH_FUZZER_H
#define TEST_FUZZTEST_GET_BLOCK_DEVICE_PATH_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "GetBlockDevicePath_fuzzer"
#endif
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "GetBoolParameterCpp_fuzzer.h"
#include<string>
#include "parameters.h"
namespace OHOS {
bool FuzzGetBoolParameter(const uint8_t* data, size_t size)
{
bool result = false;
std::string key(reinterpret_cast<const char*>(data), size);
if (system::GetBoolParameter(key, false)) {
result = true;
}
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzGetBoolParameter(data, size);
return 0;
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_FUZZTEST_GET_BOOL_PARAMETER_CPP_FUZZER_H
#define TEST_FUZZTEST_GET_BOOL_PARAMETER_CPP_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "GetBoolParameterCpp_fuzzer"
#endif
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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 <string>
#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;
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "GetBootloaderVersion_fuzzer.h"
#include <string>
#include "parameter.h"
namespace OHOS {
bool FuzzGetBootloaderVersion(const uint8_t* data, size_t size)
{
bool result = false;
if (GetBootloaderVersion() != nullptr) {
result = true;
};
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzGetBootloaderVersion(data, size);
return 0;
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_FUZZTEST_GET_BOOTLOADER_VERSION_H
#define TEST_FUZZTEST_GET_BOOTLOADER_VERSION_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "GetBootloaderVersion_fuzzer"
#endif
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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 <string>
#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;
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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 <string>
#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;
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "GetBuildRootHash_fuzzer.h"
#include <string>
#include "parameter.h"
namespace OHOS {
bool FuzzGetBuildRootHash(const uint8_t* data, size_t size)
{
bool result = false;
if (GetBuildRootHash() != nullptr) {
result = true;
};
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzGetBuildRootHash(data, size);
return 0;
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_FUZZTEST_GET_BUILD_ROOT_HASH_H
#define TEST_FUZZTEST_GET_BUILD_ROOT_HASH_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "GetBuildRootHash_fuzzer"
#endif
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册