diff --git a/BUILD.gn b/BUILD.gn index 71f3ee228b6dc2bbbb2dea9533512794a2d15b60..6d80a18e11ddf82ab728a46e17ddebb56079dbb8 100755 --- a/BUILD.gn +++ b/BUILD.gn @@ -31,6 +31,7 @@ group("fuzztest") { "services/distributeddataservice/adapter/test:fuzztest", "services/distributeddataservice/app/test/fuzztest:fuzztest", "services/distributeddataservice/service/test/fuzztest:fuzztest", + "services/distributeddataservice/framework/test/fuzztest:fuzztest", ] } ############################################################################### diff --git a/services/distributeddataservice/framework/test/fuzztest/BUILD.gn b/services/distributeddataservice/framework/test/fuzztest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..b35cb67af178f4630b3f50d1f4cbd1170d81ff2c --- /dev/null +++ b/services/distributeddataservice/framework/test/fuzztest/BUILD.gn @@ -0,0 +1,25 @@ +# 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. + +import("//build/ohos.gni") +import("//foundation/distributeddatamgr/datamgr_service/datamgr_service.gni") + +######################################################################################### +group("fuzztest") { + testonly = true + + deps = [ + "storedebuginfo_fuzzer:fuzztest", + "screenmanager_fuzzer:fuzztest", + ] +} \ No newline at end of file diff --git a/services/distributeddataservice/framework/test/fuzztest/screenmanager_fuzzer/BUILD.gn b/services/distributeddataservice/framework/test/fuzztest/screenmanager_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f063faa15c3e8a5a0e1e28ad2119271ce4a6930b --- /dev/null +++ b/services/distributeddataservice/framework/test/fuzztest/screenmanager_fuzzer/BUILD.gn @@ -0,0 +1,55 @@ +# 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. +##############################hydra-fuzz######################################## +import("//build/config/features.gni") +import("//build/test.gni") +import("//foundation/distributeddatamgr/datamgr_service/datamgr_service.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ScreenManagerFuzzTest") { + module_out_path = "datamgr_service/datamgr_service" + + include_dirs = [ + "${data_service_path}/framework/include", + ] + + fuzz_config_file = + "${data_service_path}/framework/test/fuzztest/screenmanager_fuzzer" + + sources = [ "screenmanager_fuzzer.cpp" ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + + deps = [ + "${data_service_path}/framework:distributeddatasvcfwk", + ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + "kv_store:datamgr_common", + ] +} + +############################################################################### +group("fuzztest") { + testonly = true + + deps = [ ":ScreenManagerFuzzTest" ] +} +############################################################################### \ No newline at end of file diff --git a/services/distributeddataservice/framework/test/fuzztest/screenmanager_fuzzer/corpus/init b/services/distributeddataservice/framework/test/fuzztest/screenmanager_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..7ade8a0faafeaedba7241e7d4a97b8e1f9691932 --- /dev/null +++ b/services/distributeddataservice/framework/test/fuzztest/screenmanager_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/services/distributeddataservice/framework/test/fuzztest/screenmanager_fuzzer/project.xml b/services/distributeddataservice/framework/test/fuzztest/screenmanager_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..a37a23b1533f07ab59744732b0f46b2b5fd958d8 --- /dev/null +++ b/services/distributeddataservice/framework/test/fuzztest/screenmanager_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/services/distributeddataservice/framework/test/fuzztest/screenmanager_fuzzer/screenmanager_fuzzer.cpp b/services/distributeddataservice/framework/test/fuzztest/screenmanager_fuzzer/screenmanager_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d944f95c32460f65b1dbaa5db93703e895cf2f26 --- /dev/null +++ b/services/distributeddataservice/framework/test/fuzztest/screenmanager_fuzzer/screenmanager_fuzzer.cpp @@ -0,0 +1,40 @@ +/* + * 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 +#include "screenmanager_fuzzer.h" +#include "screen/screen_manager.h" + +using namespace OHOS::DistributedData; + +namespace OHOS { +void TestScreenManager(FuzzedDataProvider &provider) +{ + ScreenManager::GetInstance()->Subscribe(nullptr); + ScreenManager::GetInstance()->Unsubscribe(nullptr); + ScreenManager::GetInstance()->BindExecutor(nullptr); + ScreenManager::GetInstance()->SubscribeScreenEvent(); + ScreenManager::GetInstance()->UnsubscribeScreenEvent(); +} + +} // namespace OHOS + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + FuzzedDataProvider provider(data, size); + OHOS::TestScreenManager(provider); + return 0; +} \ No newline at end of file diff --git a/services/distributeddataservice/framework/test/fuzztest/screenmanager_fuzzer/screenmanager_fuzzer.h b/services/distributeddataservice/framework/test/fuzztest/screenmanager_fuzzer/screenmanager_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..ab2fe6fe3efc801f5bc6b74e8a7861e05babcbfb --- /dev/null +++ b/services/distributeddataservice/framework/test/fuzztest/screenmanager_fuzzer/screenmanager_fuzzer.h @@ -0,0 +1,21 @@ +/* + * 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 SCREENMANAGER_FUZZER_H +#define SCREENMANAGER_FUZZER_H + +#define FUZZ_PROJECT_NAME "screenmanager_fuzzer" + +#endif // SCREENMANAGER_FUZZER_H diff --git a/services/distributeddataservice/framework/test/fuzztest/storedebuginfo_fuzzer/BUILD.gn b/services/distributeddataservice/framework/test/fuzztest/storedebuginfo_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..fd6c2367f9ec5b84138e895b604abd94032e78da --- /dev/null +++ b/services/distributeddataservice/framework/test/fuzztest/storedebuginfo_fuzzer/BUILD.gn @@ -0,0 +1,55 @@ +# 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. +##############################hydra-fuzz######################################## +import("//build/config/features.gni") +import("//build/test.gni") +import("//foundation/distributeddatamgr/datamgr_service/datamgr_service.gni") + +##############################fuzztest########################################## +ohos_fuzztest("StoreDebugInfoFuzzTest") { + module_out_path = "datamgr_service/datamgr_service" + + include_dirs = [ + "${data_service_path}/framework/include", + ] + + fuzz_config_file = + "${data_service_path}/framework/test/fuzztest/storedebuginfo_fuzzer" + + sources = [ "storedebuginfo_fuzzer.cpp" ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + + deps = [ + "${data_service_path}/framework:distributeddatasvcfwk", + ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + "kv_store:datamgr_common", + ] +} + +############################################################################### +group("fuzztest") { + testonly = true + + deps = [ ":StoreDebugInfoFuzzTest" ] +} +############################################################################### \ No newline at end of file diff --git a/services/distributeddataservice/framework/test/fuzztest/storedebuginfo_fuzzer/corpus/init b/services/distributeddataservice/framework/test/fuzztest/storedebuginfo_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..7ade8a0faafeaedba7241e7d4a97b8e1f9691932 --- /dev/null +++ b/services/distributeddataservice/framework/test/fuzztest/storedebuginfo_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/services/distributeddataservice/framework/test/fuzztest/storedebuginfo_fuzzer/project.xml b/services/distributeddataservice/framework/test/fuzztest/storedebuginfo_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..a37a23b1533f07ab59744732b0f46b2b5fd958d8 --- /dev/null +++ b/services/distributeddataservice/framework/test/fuzztest/storedebuginfo_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/services/distributeddataservice/framework/test/fuzztest/storedebuginfo_fuzzer/storedebuginfo_fuzzer.cpp b/services/distributeddataservice/framework/test/fuzztest/storedebuginfo_fuzzer/storedebuginfo_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f497a3d16753eb0f3053784ba2cb012ca5b6d6b6 --- /dev/null +++ b/services/distributeddataservice/framework/test/fuzztest/storedebuginfo_fuzzer/storedebuginfo_fuzzer.cpp @@ -0,0 +1,55 @@ +/* + * 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 +#include "storedebuginfo_fuzzer.h" +#include "metadata/store_debug_info.h" + +using namespace OHOS::DistributedData; + +namespace OHOS { + +void StoreDebugInfoFuzz(FuzzedDataProvider &provider) +{ + StoreDebugInfo::FileInfo fileInfo; + StoreDebugInfo debugInfo; + std::string fileName = "filename"; + debugInfo.fileInfos.insert(std::make_pair(fileName, fileInfo)); + Serializable::json node; + std::string key = provider.ConsumeRandomLengthString(); + std::string valueStr = provider.ConsumeRandomLengthString(); + int valueInt = provider.ConsumeIntegral(); + float valueFloat = provider.ConsumeFloatingPoint(); + bool valueBool = provider.ConsumeBool(); + int valueRange = provider.ConsumeIntegralInRange(0, 100); + node[key] = valueStr; + node["integer"] = valueInt; + node["float"] = valueFloat; + node["boolean"] = valueBool; + node["range"] = valueRange; + fileInfo.Marshal(node); + fileInfo.Unmarshal(node); + debugInfo.Marshal(node); + debugInfo.Unmarshal(node); +} +} // namespace OHOS + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + FuzzedDataProvider provider(data, size); + OHOS::StoreDebugInfoFuzz(provider); + return 0; +} \ No newline at end of file diff --git a/services/distributeddataservice/framework/test/fuzztest/storedebuginfo_fuzzer/storedebuginfo_fuzzer.h b/services/distributeddataservice/framework/test/fuzztest/storedebuginfo_fuzzer/storedebuginfo_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..152fe67a68dbd7930386bfa5a930bee2eb4bf3f7 --- /dev/null +++ b/services/distributeddataservice/framework/test/fuzztest/storedebuginfo_fuzzer/storedebuginfo_fuzzer.h @@ -0,0 +1,21 @@ +/* + * 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 STOREDEBUGINFO_FUZZER_H +#define STOREDEBUGINFO_FUZZER_H + +#define FUZZ_PROJECT_NAME "storedebuginfo_fuzzer" + +#endif // STOREDEBUGINFO_FUZZER_H \ No newline at end of file diff --git a/services/distributeddataservice/service/test/fuzztest/BUILD.gn b/services/distributeddataservice/service/test/fuzztest/BUILD.gn index efc92352430c137946660de49280abbe6e5ed71f..f444f810bb828e76b44293dd8e38e1d20e794198 100644 --- a/services/distributeddataservice/service/test/fuzztest/BUILD.gn +++ b/services/distributeddataservice/service/test/fuzztest/BUILD.gn @@ -21,7 +21,10 @@ group("fuzztest") { deps = [ "dumphelper_fuzzer:fuzztest" ] if (datamgr_service_cloud) { - deps += [ "cloudservicestub_fuzzer:fuzztest" ] + deps += [ + "cloudservicestub_fuzzer:fuzztest", + "syncstrategies_fuzzer:fuzztest", + ] } if (datamgr_service_object) { diff --git a/services/distributeddataservice/service/test/fuzztest/syncstrategies_fuzzer/BUILD.gn b/services/distributeddataservice/service/test/fuzztest/syncstrategies_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..fcc9489e426bae47f45c515e882b67697d78be32 --- /dev/null +++ b/services/distributeddataservice/service/test/fuzztest/syncstrategies_fuzzer/BUILD.gn @@ -0,0 +1,66 @@ +# 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. +##############################hydra-fuzz######################################## +import("//build/config/features.gni") +import("//build/test.gni") +import("//foundation/distributeddatamgr/datamgr_service/datamgr_service.gni") + +##############################fuzztest########################################## +ohos_fuzztest("SyncStrategiesFuzzTest") { + module_out_path = "datamgr_service/datamgr_service" + + include_dirs = [ + "${data_service_path}/framework/include", + "${data_service_path}/service/cloud", + "${data_service_path}/service/common", + ] + + fuzz_config_file = + "${data_service_path}/service/test/fuzztest/syncstrategies_fuzzer" + + sources = [ "syncstrategies_fuzzer.cpp" ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + "-fno-access-control", + ] + + deps = [ + "${data_service_path}/adapter/dfx:distributeddata_dfx", + "${data_service_path}/framework:distributeddatasvcfwk", + "${data_service_path}/service/cloud:distributeddata_cloud", + "${data_service_path}/service/common:distributeddata_common", + "${data_service_path}/service/bootstrap:distributeddata_bootstrap", + "${data_service_path}/service/permission:distributeddata_permit", + ] + + external_deps = [ + "access_token:libaccesstoken_sdk", + "access_token:libtoken_setproc", + "access_token:libtokenid_sdk", + "c_utils:utils", + "hilog:libhilog", + "kv_store:datamgr_common", + ] +} + +############################################################################### +group("fuzztest") { + testonly = true + + deps = [ ":SyncStrategiesFuzzTest" ] +} +############################################################################### \ No newline at end of file diff --git a/services/distributeddataservice/service/test/fuzztest/syncstrategies_fuzzer/corpus/init b/services/distributeddataservice/service/test/fuzztest/syncstrategies_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..7ade8a0faafeaedba7241e7d4a97b8e1f9691932 --- /dev/null +++ b/services/distributeddataservice/service/test/fuzztest/syncstrategies_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/services/distributeddataservice/service/test/fuzztest/syncstrategies_fuzzer/project.xml b/services/distributeddataservice/service/test/fuzztest/syncstrategies_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..a37a23b1533f07ab59744732b0f46b2b5fd958d8 --- /dev/null +++ b/services/distributeddataservice/service/test/fuzztest/syncstrategies_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/services/distributeddataservice/service/test/fuzztest/syncstrategies_fuzzer/syncstrategies_fuzzer.cpp b/services/distributeddataservice/service/test/fuzztest/syncstrategies_fuzzer/syncstrategies_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a29c25be20acbd67434ccc072634f59808b6a423 --- /dev/null +++ b/services/distributeddataservice/service/test/fuzztest/syncstrategies_fuzzer/syncstrategies_fuzzer.cpp @@ -0,0 +1,78 @@ +/* + * 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 +#include "syncstrategies_fuzzer.h" +#include "sync_strategies/network_sync_strategy.h" + +using namespace OHOS::DistributedData; +using namespace OHOS::CloudData; + +namespace OHOS { +void SyncStrategiesFuzz001(FuzzedDataProvider &provider) +{ + int32_t user = provider.ConsumeIntegral(); + std::string bundleName = provider.ConsumeRandomLengthString(); + NetworkSyncStrategy strategy; + StoreInfo storeInfo; + storeInfo.user = user; + storeInfo.bundleName = bundleName; + strategy.CheckSyncAction(storeInfo); +} + +void SyncStrategiesFuzz002(FuzzedDataProvider &provider) +{ + uint32_t strategy = provider.ConsumeIntegral(); + NetworkSyncStrategy strategyInstance; + strategyInstance.Check(strategy); +} + +void SyncStrategiesFuzz003(FuzzedDataProvider &provider) +{ + int32_t user = provider.ConsumeIntegral(); + std::string bundleName = provider.ConsumeRandomLengthString(); + NetworkSyncStrategy strategyInstance; + strategyInstance.GetStrategy(user, bundleName); + strategyInstance.GetKey(user); + + NetworkSyncStrategy::StrategyInfo info; + info.user = 1; + info.bundleName = "StrategyInfo"; + Serializable::json node; + std::string key = provider.ConsumeRandomLengthString(); + std::string valueStr = provider.ConsumeRandomLengthString(); + int valueInt = provider.ConsumeIntegral(); + float valueFloat = provider.ConsumeFloatingPoint(); + bool valueBool = provider.ConsumeBool(); + int valueRange = provider.ConsumeIntegralInRange(0, 100); + node[key] = valueStr; + node["integer"] = valueInt; + node["float"] = valueFloat; + node["boolean"] = valueBool; + node["range"] = valueRange; + info.Marshal(node); + info.Unmarshal(node); +} +} // namespace OHOS + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + FuzzedDataProvider provider(data, size); + OHOS::SyncStrategiesFuzz001(provider); + OHOS::SyncStrategiesFuzz002(provider); + OHOS::SyncStrategiesFuzz003(provider); + return 0; +} \ No newline at end of file diff --git a/services/distributeddataservice/service/test/fuzztest/syncstrategies_fuzzer/syncstrategies_fuzzer.h b/services/distributeddataservice/service/test/fuzztest/syncstrategies_fuzzer/syncstrategies_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..ab2199aa1ca48a9cbd7cdd3bee0ac0319b239049 --- /dev/null +++ b/services/distributeddataservice/service/test/fuzztest/syncstrategies_fuzzer/syncstrategies_fuzzer.h @@ -0,0 +1,21 @@ +/* + * 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 SYNCSTRATEGIES_FUZZER_H +#define SYNCSTRATEGIES_FUZZER_H + +#define FUZZ_PROJECT_NAME "syncstrategies_fuzzer" + +#endif // SYNCSTRATEGIES_FUZZER_H \ No newline at end of file