mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-23 06:50:40 +00:00
add scene_session_manager_lite fuzz testcase
Signed-off-by: yuantianzhu1@huawei.com <yuantianzhu1@huawei.com>
This commit is contained in:
parent
36bd5e47b9
commit
30e958064f
@ -0,0 +1,108 @@
|
||||
# Copyright (c) 2024 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/config/features.gni")
|
||||
import("//build/test.gni")
|
||||
import("../../../../windowmanager_aafwk.gni")
|
||||
|
||||
module_output_path = "window_manager/window_manager"
|
||||
|
||||
##############################fuzztest##########################################
|
||||
ohos_fuzztest("SceneSessionMgrLStubIconFuzzTest") {
|
||||
fuzz_config_file = "."
|
||||
module_out_path = module_output_path
|
||||
|
||||
include_dirs = [
|
||||
"${window_base_path}/window_scene",
|
||||
"${window_base_path}/window_scene/session_manager/include",
|
||||
"${window_base_path}/window_scene/session_manager/include/zidl",
|
||||
"../",
|
||||
|
||||
# for session_manager
|
||||
"${window_base_path}/wmserver/include",
|
||||
"${window_base_path}/wmserver/include/zidl",
|
||||
|
||||
# for window_manager
|
||||
"${window_base_path}/utils/include",
|
||||
"${window_base_path}/wm/include",
|
||||
"${window_base_path}/wm/include/zidl",
|
||||
]
|
||||
cflags = [
|
||||
"-g",
|
||||
"-O0",
|
||||
"-fno-omit-frame-pointer",
|
||||
]
|
||||
sources = [ "scenesessionmgrlstubicon_fuzzer.cpp" ]
|
||||
deps = [
|
||||
"${window_base_path}/dm:libdm",
|
||||
"${window_base_path}/utils:libwmutil",
|
||||
"${window_base_path}/utils:libwmutil_base",
|
||||
"${window_base_path}/window_scene/common:window_scene_common",
|
||||
"${window_base_path}/window_scene/intention_event/service:intention_event_anr_manager",
|
||||
"${window_base_path}/window_scene/screen_session_manager:screen_session_manager_client",
|
||||
"${window_base_path}/window_scene/session:scene_session",
|
||||
"${window_base_path}/window_scene/session:screen_session",
|
||||
"${window_base_path}/window_scene/session_manager:scene_session_manager",
|
||||
]
|
||||
public_external_deps = [
|
||||
"ability_runtime:session_handler",
|
||||
"accessibility:accessibility_common",
|
||||
"graphic_2d:window_animation",
|
||||
"input:libmmi-client",
|
||||
"input:libmmi-util",
|
||||
]
|
||||
external_deps = [
|
||||
"ability_base:configuration",
|
||||
"ability_base:session_info",
|
||||
"ability_base:want",
|
||||
"ability_runtime:ability_context_native",
|
||||
"ability_runtime:ability_deps_wrapper",
|
||||
"ability_runtime:ability_manager",
|
||||
"ability_runtime:ability_start_setting",
|
||||
"ability_runtime:app_manager",
|
||||
"ability_runtime:mission_info",
|
||||
"ability_runtime:session_handler",
|
||||
"ace_engine:ace_uicontent",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"c_utils:utils",
|
||||
"config_policy:configpolicy_util",
|
||||
"dsoftbus:softbus_client",
|
||||
"eventhandler:libeventhandler",
|
||||
"ffrt:libffrt",
|
||||
"graphic_2d:librender_service_client",
|
||||
"hicollie:libhicollie",
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
"image_framework:image_native",
|
||||
"init:libbegetutil",
|
||||
"input:libmmi-client",
|
||||
"ipc:ipc_single",
|
||||
"libxml2:libxml2",
|
||||
"napi:ace_napi",
|
||||
"resource_management:global_resmgr",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
group("fuzztest") {
|
||||
testonly = true
|
||||
deps = []
|
||||
|
||||
deps += [
|
||||
# deps file
|
||||
":SceneSessionMgrLStubIconFuzzTest",
|
||||
]
|
||||
}
|
||||
###############################################################################
|
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2024 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
|
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (c) 2024 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>1000</max_len>
|
||||
<!-- maximum total time in seconds to run the fuzzer -->
|
||||
<max_total_time>300</max_total_time>
|
||||
<!-- memory usage limit in Mb -->
|
||||
<rss_limit_mb>4096</rss_limit_mb>
|
||||
</fuzztest>
|
||||
</fuzz_config>
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 "scenesessionmgrlstubicon_fuzzer.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <parcel.h>
|
||||
#include <securec.h>
|
||||
|
||||
#include <iremote_stub.h>
|
||||
#include "message_option.h"
|
||||
#include "message_parcel.h"
|
||||
#include "marshalling_helper.h"
|
||||
#include "scene_session_manager_lite.h"
|
||||
#include "scene_session_manager_lite_stub.h"
|
||||
#include "scene_session_manager_lite_interface.h"
|
||||
|
||||
using namespace OHOS::Rosen;
|
||||
|
||||
namespace OHOS {
|
||||
namespace {
|
||||
constexpr size_t DATA_MIN_SIZE = 2;
|
||||
}
|
||||
|
||||
bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
|
||||
{
|
||||
if (data == nullptr || size < DATA_MIN_SIZE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MessageParcel parcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
parcel.WriteInterfaceToken(SceneSessionManagerLiteStub::GetDescriptor());
|
||||
parcel.WriteBuffer(data, size);
|
||||
parcel.RewindRead(0);
|
||||
|
||||
SceneSessionManagerLite::GetInstance().OnRemoteRequest(
|
||||
static_cast<uint32_t>(ISceneSessionManagerLite::
|
||||
SceneSessionManagerLiteMessage::TRANS_ID_SET_SESSION_ICON),
|
||||
parcel, reply, option);
|
||||
return true;
|
||||
}
|
||||
} // namespace OHOS
|
||||
|
||||
/* Fuzzer entry point */
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
/* Run your code on data */
|
||||
OHOS::DoSomethingInterestingWithMyAPI(data, size);
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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_SCENE_SESSION_MANAGER_LITE_STUB_ICON_FUZZER_H
|
||||
#define TEST_FUZZTEST_SCENE_SESSION_MANAGER_LITE_STUB_ICON_FUZZER_H
|
||||
|
||||
#define FUZZ_PROJECT_NAME "scenesessionmgrlstubicon_fuzzer"
|
||||
|
||||
#endif
|
@ -0,0 +1,108 @@
|
||||
# Copyright (c) 2024 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/config/features.gni")
|
||||
import("//build/test.gni")
|
||||
import("../../../../windowmanager_aafwk.gni")
|
||||
|
||||
module_output_path = "window_manager/window_manager"
|
||||
|
||||
##############################fuzztest##########################################
|
||||
ohos_fuzztest("SceneSessionMgrLStubLabelFuzzTest") {
|
||||
fuzz_config_file = "."
|
||||
module_out_path = module_output_path
|
||||
|
||||
include_dirs = [
|
||||
"${window_base_path}/window_scene",
|
||||
"${window_base_path}/window_scene/session_manager/include",
|
||||
"${window_base_path}/window_scene/session_manager/include/zidl",
|
||||
"../",
|
||||
|
||||
# for session_manager
|
||||
"${window_base_path}/wmserver/include",
|
||||
"${window_base_path}/wmserver/include/zidl",
|
||||
|
||||
# for window_manager
|
||||
"${window_base_path}/utils/include",
|
||||
"${window_base_path}/wm/include",
|
||||
"${window_base_path}/wm/include/zidl",
|
||||
]
|
||||
cflags = [
|
||||
"-g",
|
||||
"-O0",
|
||||
"-fno-omit-frame-pointer",
|
||||
]
|
||||
sources = [ "scenesessionmgrlstublabel_fuzzer.cpp" ]
|
||||
deps = [
|
||||
"${window_base_path}/dm:libdm",
|
||||
"${window_base_path}/utils:libwmutil",
|
||||
"${window_base_path}/utils:libwmutil_base",
|
||||
"${window_base_path}/window_scene/common:window_scene_common",
|
||||
"${window_base_path}/window_scene/intention_event/service:intention_event_anr_manager",
|
||||
"${window_base_path}/window_scene/screen_session_manager:screen_session_manager_client",
|
||||
"${window_base_path}/window_scene/session:scene_session",
|
||||
"${window_base_path}/window_scene/session:screen_session",
|
||||
"${window_base_path}/window_scene/session_manager:scene_session_manager",
|
||||
]
|
||||
public_external_deps = [
|
||||
"ability_runtime:session_handler",
|
||||
"accessibility:accessibility_common",
|
||||
"graphic_2d:window_animation",
|
||||
"input:libmmi-client",
|
||||
"input:libmmi-util",
|
||||
]
|
||||
external_deps = [
|
||||
"ability_base:configuration",
|
||||
"ability_base:session_info",
|
||||
"ability_base:want",
|
||||
"ability_runtime:ability_context_native",
|
||||
"ability_runtime:ability_deps_wrapper",
|
||||
"ability_runtime:ability_manager",
|
||||
"ability_runtime:ability_start_setting",
|
||||
"ability_runtime:app_manager",
|
||||
"ability_runtime:mission_info",
|
||||
"ability_runtime:session_handler",
|
||||
"ace_engine:ace_uicontent",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"c_utils:utils",
|
||||
"config_policy:configpolicy_util",
|
||||
"dsoftbus:softbus_client",
|
||||
"eventhandler:libeventhandler",
|
||||
"ffrt:libffrt",
|
||||
"graphic_2d:librender_service_client",
|
||||
"hicollie:libhicollie",
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
"image_framework:image_native",
|
||||
"init:libbegetutil",
|
||||
"input:libmmi-client",
|
||||
"ipc:ipc_single",
|
||||
"libxml2:libxml2",
|
||||
"napi:ace_napi",
|
||||
"resource_management:global_resmgr",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
group("fuzztest") {
|
||||
testonly = true
|
||||
deps = []
|
||||
|
||||
deps += [
|
||||
# deps file
|
||||
":SceneSessionMgrLStubLabelFuzzTest",
|
||||
]
|
||||
}
|
||||
###############################################################################
|
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2024 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
|
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (c) 2024 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>1000</max_len>
|
||||
<!-- maximum total time in seconds to run the fuzzer -->
|
||||
<max_total_time>300</max_total_time>
|
||||
<!-- memory usage limit in Mb -->
|
||||
<rss_limit_mb>4096</rss_limit_mb>
|
||||
</fuzztest>
|
||||
</fuzz_config>
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 "scenesessionmgrlstublabel_fuzzer.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <parcel.h>
|
||||
#include <securec.h>
|
||||
|
||||
#include <iremote_stub.h>
|
||||
#include "message_option.h"
|
||||
#include "message_parcel.h"
|
||||
#include "marshalling_helper.h"
|
||||
#include "scene_session_manager_lite.h"
|
||||
#include "scene_session_manager_lite_stub.h"
|
||||
#include "scene_session_manager_lite_interface.h"
|
||||
|
||||
using namespace OHOS::Rosen;
|
||||
|
||||
namespace OHOS {
|
||||
namespace {
|
||||
constexpr size_t DATA_MIN_SIZE = 2;
|
||||
}
|
||||
|
||||
bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
|
||||
{
|
||||
if (data == nullptr || size < DATA_MIN_SIZE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MessageParcel parcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
parcel.WriteInterfaceToken(SceneSessionManagerLiteStub::GetDescriptor());
|
||||
parcel.WriteBuffer(data, size);
|
||||
parcel.RewindRead(0);
|
||||
|
||||
SceneSessionManagerLite::GetInstance().OnRemoteRequest(
|
||||
static_cast<uint32_t>(ISceneSessionManagerLite::
|
||||
SceneSessionManagerLiteMessage::TRANS_ID_SET_SESSION_LABEL),
|
||||
parcel, reply, option);
|
||||
return true;
|
||||
}
|
||||
} // namespace OHOS
|
||||
|
||||
/* Fuzzer entry point */
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
/* Run your code on data */
|
||||
OHOS::DoSomethingInterestingWithMyAPI(data, size);
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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_SCENE_SESSION_MANAGER_LITE_STUB_LABEL_FUZZER_H
|
||||
#define TEST_FUZZTEST_SCENE_SESSION_MANAGER_LITE_STUB_LABEL_FUZZER_H
|
||||
|
||||
#define FUZZ_PROJECT_NAME "scenesessionmgrlstublabel_fuzzer"
|
||||
|
||||
#endif
|
@ -0,0 +1,108 @@
|
||||
# Copyright (c) 2024 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/config/features.gni")
|
||||
import("//build/test.gni")
|
||||
import("../../../../windowmanager_aafwk.gni")
|
||||
|
||||
module_output_path = "window_manager/window_manager"
|
||||
|
||||
##############################fuzztest##########################################
|
||||
ohos_fuzztest("SceneSessionMgrLStubTokenFuzzTest") {
|
||||
fuzz_config_file = "."
|
||||
module_out_path = module_output_path
|
||||
|
||||
include_dirs = [
|
||||
"${window_base_path}/window_scene",
|
||||
"${window_base_path}/window_scene/session_manager/include",
|
||||
"${window_base_path}/window_scene/session_manager/include/zidl",
|
||||
"../",
|
||||
|
||||
# for session_manager
|
||||
"${window_base_path}/wmserver/include",
|
||||
"${window_base_path}/wmserver/include/zidl",
|
||||
|
||||
# for window_manager
|
||||
"${window_base_path}/utils/include",
|
||||
"${window_base_path}/wm/include",
|
||||
"${window_base_path}/wm/include/zidl",
|
||||
]
|
||||
cflags = [
|
||||
"-g",
|
||||
"-O0",
|
||||
"-fno-omit-frame-pointer",
|
||||
]
|
||||
sources = [ "scenesessionmgrlstubtoken_fuzzer.cpp" ]
|
||||
deps = [
|
||||
"${window_base_path}/dm:libdm",
|
||||
"${window_base_path}/utils:libwmutil",
|
||||
"${window_base_path}/utils:libwmutil_base",
|
||||
"${window_base_path}/window_scene/common:window_scene_common",
|
||||
"${window_base_path}/window_scene/intention_event/service:intention_event_anr_manager",
|
||||
"${window_base_path}/window_scene/screen_session_manager:screen_session_manager_client",
|
||||
"${window_base_path}/window_scene/session:scene_session",
|
||||
"${window_base_path}/window_scene/session:screen_session",
|
||||
"${window_base_path}/window_scene/session_manager:scene_session_manager",
|
||||
]
|
||||
public_external_deps = [
|
||||
"ability_runtime:session_handler",
|
||||
"accessibility:accessibility_common",
|
||||
"graphic_2d:window_animation",
|
||||
"input:libmmi-client",
|
||||
"input:libmmi-util",
|
||||
]
|
||||
external_deps = [
|
||||
"ability_base:configuration",
|
||||
"ability_base:session_info",
|
||||
"ability_base:want",
|
||||
"ability_runtime:ability_context_native",
|
||||
"ability_runtime:ability_deps_wrapper",
|
||||
"ability_runtime:ability_manager",
|
||||
"ability_runtime:ability_start_setting",
|
||||
"ability_runtime:app_manager",
|
||||
"ability_runtime:mission_info",
|
||||
"ability_runtime:session_handler",
|
||||
"ace_engine:ace_uicontent",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"c_utils:utils",
|
||||
"config_policy:configpolicy_util",
|
||||
"dsoftbus:softbus_client",
|
||||
"eventhandler:libeventhandler",
|
||||
"ffrt:libffrt",
|
||||
"graphic_2d:librender_service_client",
|
||||
"hicollie:libhicollie",
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
"image_framework:image_native",
|
||||
"init:libbegetutil",
|
||||
"input:libmmi-client",
|
||||
"ipc:ipc_single",
|
||||
"libxml2:libxml2",
|
||||
"napi:ace_napi",
|
||||
"resource_management:global_resmgr",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
group("fuzztest") {
|
||||
testonly = true
|
||||
deps = []
|
||||
|
||||
deps += [
|
||||
# deps file
|
||||
":SceneSessionMgrLStubTokenFuzzTest",
|
||||
]
|
||||
}
|
||||
###############################################################################
|
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2024 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
|
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (c) 2024 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>1000</max_len>
|
||||
<!-- maximum total time in seconds to run the fuzzer -->
|
||||
<max_total_time>300</max_total_time>
|
||||
<!-- memory usage limit in Mb -->
|
||||
<rss_limit_mb>4096</rss_limit_mb>
|
||||
</fuzztest>
|
||||
</fuzz_config>
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 "scenesessionmgrlstubtoken_fuzzer.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <parcel.h>
|
||||
#include <securec.h>
|
||||
|
||||
#include <iremote_stub.h>
|
||||
#include "message_option.h"
|
||||
#include "message_parcel.h"
|
||||
#include "marshalling_helper.h"
|
||||
#include "scene_session_manager_lite.h"
|
||||
#include "scene_session_manager_lite_stub.h"
|
||||
#include "scene_session_manager_lite_interface.h"
|
||||
|
||||
using namespace OHOS::Rosen;
|
||||
|
||||
namespace OHOS {
|
||||
namespace {
|
||||
constexpr size_t DATA_MIN_SIZE = 2;
|
||||
}
|
||||
|
||||
bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
|
||||
{
|
||||
if (data == nullptr || size < DATA_MIN_SIZE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MessageParcel parcel;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
parcel.WriteInterfaceToken(SceneSessionManagerLiteStub::GetDescriptor());
|
||||
parcel.WriteBuffer(data, size);
|
||||
parcel.RewindRead(0);
|
||||
|
||||
SceneSessionManagerLite::GetInstance().OnRemoteRequest(
|
||||
static_cast<uint32_t>(ISceneSessionManagerLite::
|
||||
SceneSessionManagerLiteMessage::TRANS_ID_GET_FOCUS_SESSION_TOKEN),
|
||||
parcel, reply, option);
|
||||
return true;
|
||||
}
|
||||
} // namespace OHOS
|
||||
|
||||
/* Fuzzer entry point */
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
/* Run your code on data */
|
||||
OHOS::DoSomethingInterestingWithMyAPI(data, size);
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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_SCENE_SESSION_MANAGER_LITE_STUB_TOKEN_FUZZER_H
|
||||
#define TEST_FUZZTEST_SCENE_SESSION_MANAGER_LITE_STUB_TOKEN_FUZZER_H
|
||||
|
||||
#define FUZZ_PROJECT_NAME "scenesessionmgrlstubtoken_fuzzer"
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user