mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-23 15:20:34 +00:00
commit
60e22b0f4c
@ -39,7 +39,28 @@ uint32_t GetU32Data(const char* ptr)
|
||||
|
||||
bool DoSomethingInterestingWithMyAPI(const char* data, size_t size)
|
||||
{
|
||||
uint32_t code = GetU32Data(data) % (IAbilityManager::GET_ABILITY_TOKEN + 1);
|
||||
uint32_t code = GetU32Data(data) % (IAbilityManager::GET_ABILITY_TOKEN + IAbilityManager::SET_ROOTSSCENESESSION);
|
||||
if (code >IAbilityManager::GET_ABILITY_TOKEN) {
|
||||
code = IAbilityManager::GET_ABILITY_TOKEN;
|
||||
} else if (code > IAbilityManager::SHARE_DATA_DONE && code != IAbilityManager::GET_ABILITY_TOKEN) {
|
||||
code = IAbilityManager::ACQUIRE_SHARE_DATA +
|
||||
(code % (IAbilityManager::SHARE_DATA_DONE - IAbilityManager::ACQUIRE_SHARE_DATA + 1));
|
||||
} else if (code > IAbilityManager::VERIFY_PERMISSION) {
|
||||
code = IAbilityManager::GET_TOP_ABILITY +
|
||||
(code % (IAbilityManager::VERIFY_PERMISSION - IAbilityManager::GET_TOP_ABILITY + 1));
|
||||
} else if (code > IAbilityManager::GET_DLP_CONNECTION_INFOS) {
|
||||
code = IAbilityManager::REGISTER_WMS_HANDLER +
|
||||
(code % (IAbilityManager::GET_DLP_CONNECTION_INFOS - IAbilityManager::REGISTER_WMS_HANDLER + 1));
|
||||
} else if (code > IAbilityManager::FORCE_TIMEOUT) {
|
||||
code = IAbilityManager::DUMP_STATE +
|
||||
(code % (IAbilityManager::FORCE_TIMEOUT - IAbilityManager::DUMP_STATE + 1));
|
||||
} else if (code > IAbilityManager::GET_TOP_ABILITY_TOKEN) {
|
||||
code = IAbilityManager::START_ABILITY +
|
||||
(code % (IAbilityManager::GET_TOP_ABILITY_TOKEN - IAbilityManager::START_ABILITY + 1));
|
||||
} else if (code > IAbilityManager::SET_ROOTSSCENESESSION) {
|
||||
code = IAbilityManager::TERMINATE_ABILITY +
|
||||
(code % (IAbilityManager::SET_ROOTSSCENESESSION - IAbilityManager::TERMINATE_ABILITY + 1));
|
||||
}
|
||||
|
||||
MessageParcel parcel;
|
||||
parcel.WriteInterfaceToken(ABILITYMGR_INTERFACE_TOKEN);
|
||||
|
@ -33,7 +33,7 @@ namespace {
|
||||
constexpr size_t FOO_MAX_LEN = 1024;
|
||||
constexpr size_t U32_AT_SIZE = 4;
|
||||
}
|
||||
const std::u16string AMSMGR_INTERFACE_TOKEN = u"ohos.aafwk.AmsManager";
|
||||
const std::u16string AMSMGR_INTERFACE_TOKEN = u"ohos.appexecfwk.IAmsMgr";
|
||||
|
||||
uint32_t GetU32Data(const char* ptr)
|
||||
{
|
||||
@ -52,8 +52,7 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size)
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
std::shared_ptr<AppMgrServiceInner> appMgrServiceInner = std::make_shared<AppMgrServiceInner>();
|
||||
std::shared_ptr<EventRunner> runner = EventRunner::Create(Constants::APP_MGR_SERVICE_NAME);
|
||||
std::shared_ptr<AMSEventHandler> eventHandler = std::make_shared<AMSEventHandler>(runner, appMgrServiceInner);
|
||||
std::shared_ptr<AMSEventHandler> eventHandler = std::make_shared<AMSEventHandler>(nullptr, appMgrServiceInner);
|
||||
std::shared_ptr<AmsMgrScheduler> amsMgr = std::make_shared<AmsMgrScheduler>(appMgrServiceInner, eventHandler);
|
||||
amsMgr->OnRemoteRequest(code, parcel, reply, option);
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
using namespace OHOS::AAFwk;
|
||||
using namespace OHOS::AppExecFwk;
|
||||
|
||||
#define DISABLE_FUZZ
|
||||
namespace OHOS {
|
||||
namespace {
|
||||
constexpr size_t FOO_MAX_LEN = 1024;
|
||||
@ -49,7 +48,7 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size)
|
||||
parcel.RewindRead(0);
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
sptr<AppMgrService> appMgr = new AppMgrService();
|
||||
std::shared_ptr<AppMgrService> appMgr = std::make_shared<AppMgrService>();
|
||||
appMgr->OnRemoteRequest(code, parcel, reply, option);
|
||||
|
||||
return true;
|
||||
@ -83,9 +82,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
ch = nullptr;
|
||||
return 0;
|
||||
}
|
||||
#ifndef DISABLE_FUZZ
|
||||
OHOS::DoSomethingInterestingWithMyAPI(ch, size);
|
||||
#endif
|
||||
free(ch);
|
||||
ch = nullptr;
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user