• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #define private public
16 #define protected public
17 
18 #include "downloaduploadmanager_fuzzer.h"
19 
20 #include <securec.h>
21 
22 #include <cstddef>
23 #include <cstdint>
24 
25 #include "accesstoken_kit.h"
26 #include "message_parcel.h"
27 #include "nativetoken_kit.h"
28 #include "request.h"
29 #include "request_common.h"
30 #include "request_manager.h"
31 #include "request_manager_impl.h"
32 #include "request_running_task_count.h"
33 #include "request_service_interface.h"
34 #include "runcount_notify_stub.h"
35 #include "running_task_count.h"
36 #include "system_ability_definition.h"
37 #include "token_setproc.h"
38 
39 using namespace OHOS::Request;
40 using namespace OHOS::Security::AccessToken;
41 
42 #undef private
43 #undef protected
44 
45 namespace OHOS {
46 
ConvertToUint32(const uint8_t * ptr,size_t size)47 uint32_t ConvertToUint32(const uint8_t *ptr, size_t size)
48 {
49     if (ptr == nullptr || (size < sizeof(uint32_t))) {
50         return 0;
51     }
52     return *(reinterpret_cast<const uint32_t *>(ptr));
53 }
54 
GrantNativePermission()55 void GrantNativePermission()
56 {
57     const char **perms = new const char *[1];
58     perms[0] = "ohos.permission.INTERNET";
59     TokenInfoParams infoInstance = {
60         .dcapsNum = 0,
61         .permsNum = 1,
62         .aclsNum = 0,
63         .dcaps = nullptr,
64         .perms = perms,
65         .acls = nullptr,
66         .processName = "request_service",
67         .aplStr = "system_core",
68     };
69     uint64_t tokenId = GetAccessTokenId(&infoInstance);
70     SetSelfTokenID(tokenId);
71     AccessTokenKit::ReloadNativeTokenInfo();
72     delete[] perms;
73 }
74 
CreateRequestFuzzTest(const uint8_t * data,size_t size)75 void CreateRequestFuzzTest(const uint8_t *data, size_t size)
76 {
77     Config config;
78     std::string tid(reinterpret_cast<const char *>(data), size);
79 
80     GrantNativePermission();
81     int32_t seq = RequestManager::GetInstance()->GetNextSeq();
82     RequestManager::GetInstance()->Create(config, seq, tid);
83 }
84 
StartRequestFuzzTest(const uint8_t * data,size_t size)85 void StartRequestFuzzTest(const uint8_t *data, size_t size)
86 {
87     std::string tid(reinterpret_cast<const char *>(data), size);
88     GrantNativePermission();
89     RequestManager::GetInstance()->Start(tid);
90 }
91 
StopRequestFuzzTest(const uint8_t * data,size_t size)92 void StopRequestFuzzTest(const uint8_t *data, size_t size)
93 {
94     std::string tid(reinterpret_cast<const char *>(data), size);
95     GrantNativePermission();
96     RequestManager::GetInstance()->Stop(tid);
97 }
98 
ShowRequestFuzzTest(const uint8_t * data,size_t size)99 void ShowRequestFuzzTest(const uint8_t *data, size_t size)
100 {
101     TaskInfo info;
102     std::string tid(reinterpret_cast<const char *>(data), size);
103     GrantNativePermission();
104     RequestManager::GetInstance()->Show(tid, info);
105 }
106 
TouchRequestFuzzTest(const uint8_t * data,size_t size)107 void TouchRequestFuzzTest(const uint8_t *data, size_t size)
108 {
109     TaskInfo info;
110     std::string tid(reinterpret_cast<const char *>(data), size);
111     std::string token(data, data + size);
112     GrantNativePermission();
113     RequestManager::GetInstance()->Touch(tid, token, info);
114 }
115 
SearchRequestFuzzTest(const uint8_t * data,size_t size)116 void SearchRequestFuzzTest(const uint8_t *data, size_t size)
117 {
118     Filter filter;
119     std::vector<std::string> tids;
120     std::string str(reinterpret_cast<const char *>(data), size);
121     tids.push_back(str);
122     GrantNativePermission();
123     RequestManager::GetInstance()->Search(filter, tids);
124 }
125 
PauseRequestFuzzTest(const uint8_t * data,size_t size)126 void PauseRequestFuzzTest(const uint8_t *data, size_t size)
127 {
128     Version version = static_cast<Version>(ConvertToUint32(data, size));
129     std::string tid(reinterpret_cast<const char *>(data), size);
130     GrantNativePermission();
131     RequestManager::GetInstance()->Pause(tid, version);
132 }
133 
QueryMimeTypeRequestFuzzTest(const uint8_t * data,size_t size)134 void QueryMimeTypeRequestFuzzTest(const uint8_t *data, size_t size)
135 {
136     std::string tid(reinterpret_cast<const char *>(data), size);
137     std::string mimeType(data, data + size);
138     GrantNativePermission();
139     RequestManager::GetInstance()->QueryMimeType(tid, mimeType);
140 }
141 
RemoveRequestFuzzTest(const uint8_t * data,size_t size)142 void RemoveRequestFuzzTest(const uint8_t *data, size_t size)
143 {
144     Version version = static_cast<Version>(ConvertToUint32(data, size));
145     std::string tid(reinterpret_cast<const char *>(data), size);
146     GrantNativePermission();
147     RequestManager::GetInstance()->Remove(tid, version);
148 }
149 
ResumeRequestFuzzTest(const uint8_t * data,size_t size)150 void ResumeRequestFuzzTest(const uint8_t *data, size_t size)
151 {
152     std::string tid(reinterpret_cast<const char *>(data), size);
153     GrantNativePermission();
154     RequestManager::GetInstance()->Resume(tid);
155 }
156 
GetTaskRequestFuzzTest(const uint8_t * data,size_t size)157 void GetTaskRequestFuzzTest(const uint8_t *data, size_t size)
158 {
159     Config config;
160     std::string tid(reinterpret_cast<const char *>(data), size);
161     std::string token(reinterpret_cast<const char *>(data), size);
162     GrantNativePermission();
163     RequestManager::GetInstance()->GetTask(tid, token, config);
164 }
165 
SubscribeRequestFuzzTest(const uint8_t * data,size_t size)166 void SubscribeRequestFuzzTest(const uint8_t *data, size_t size)
167 {
168     std::string tid(reinterpret_cast<const char *>(data), size);
169     GrantNativePermission();
170     RequestManager::GetInstance()->Subscribe(tid);
171 }
172 
UnsubscribeRequestFuzzTest(const uint8_t * data,size_t size)173 void UnsubscribeRequestFuzzTest(const uint8_t *data, size_t size)
174 {
175     std::string tid(reinterpret_cast<const char *>(data), size);
176     GrantNativePermission();
177     RequestManager::GetInstance()->Unsubscribe(tid);
178 }
179 
IsSaReadyRequestFuzzTest(const uint8_t * data,size_t size)180 void IsSaReadyRequestFuzzTest(const uint8_t *data, size_t size)
181 {
182     GrantNativePermission();
183     RequestManager::GetInstance()->IsSaReady();
184     std::string tid(reinterpret_cast<const char *>(data), size);
185     RequestManager::GetInstance()->Start(tid);
186 }
187 
ReopenChannelRequestFuzzTest(const uint8_t * data,size_t size)188 void ReopenChannelRequestFuzzTest(const uint8_t *data, size_t size)
189 {
190     GrantNativePermission();
191     RequestManager::GetInstance()->ReopenChannel();
192     std::string tid(reinterpret_cast<const char *>(data), size);
193     RequestManager::GetInstance()->Start(tid);
194 }
195 
SubscribeSARequestFuzzTest(const uint8_t * data,size_t size)196 void SubscribeSARequestFuzzTest(const uint8_t *data, size_t size)
197 {
198     GrantNativePermission();
199     RequestManager::GetInstance()->SubscribeSA();
200     RequestManager::GetInstance()->UnsubscribeSA();
201     std::string tid(reinterpret_cast<const char *>(data), size);
202     RequestManager::GetInstance()->Start(tid);
203 }
204 
205 class FuzzResponseListenerImpl : public IResponseListener {
206 public:
~FuzzResponseListenerImpl()207     ~FuzzResponseListenerImpl(){};
OnResponseReceive(const std::shared_ptr<Response> & response)208     void OnResponseReceive(const std::shared_ptr<Response> &response) override
209     {
210         (void)response;
211         return;
212     }
213 };
214 
215 class FuzzNotifyDataListenerImpl : public INotifyDataListener {
216 public:
~FuzzNotifyDataListenerImpl()217     ~FuzzNotifyDataListenerImpl(){};
OnNotifyDataReceive(const std::shared_ptr<NotifyData> & notifyData)218     void OnNotifyDataReceive(const std::shared_ptr<NotifyData> &notifyData) override
219     {
220         (void)notifyData;
221         return;
222     }
OnFaultsReceive(const std::shared_ptr<int32_t> & tid,const std::shared_ptr<SubscribeType> & type,const std::shared_ptr<Reason> & reason)223     void OnFaultsReceive(const std::shared_ptr<int32_t> &tid, const std::shared_ptr<SubscribeType> &type,
224         const std::shared_ptr<Reason> &reason) override
225     {
226     }
OnWaitReceive(std::int32_t taskId,WaitingReason reason)227     void OnWaitReceive(std::int32_t taskId, WaitingReason reason) override
228     {
229     }
230 };
231 
AddAndRemoveListenerRequestFuzzTest(const uint8_t * data,size_t size)232 void AddAndRemoveListenerRequestFuzzTest(const uint8_t *data, size_t size)
233 {
234     std::string taskId(reinterpret_cast<const char *>(data), size);
235     GrantNativePermission();
236     SubscribeType type = SubscribeType::RESPONSE;
237     std::shared_ptr<FuzzResponseListenerImpl> listener = std::make_shared<FuzzResponseListenerImpl>();
238     RequestManager::GetInstance()->AddListener(taskId, type, listener);
239     RequestManager::GetInstance()->RemoveListener(taskId, type, listener);
240     type = SubscribeType::COMPLETED;
241     std::shared_ptr<FuzzNotifyDataListenerImpl> listener2 = std::make_shared<FuzzNotifyDataListenerImpl>();
242     RequestManager::GetInstance()->AddListener(taskId, type, listener2);
243     RequestManager::GetInstance()->RemoveListener(taskId, type, listener2);
244 }
245 
RemoveAllListenersRequestFuzzTest(const uint8_t * data,size_t size)246 void RemoveAllListenersRequestFuzzTest(const uint8_t *data, size_t size)
247 {
248     std::string taskId(reinterpret_cast<const char *>(data), size);
249     GrantNativePermission();
250     SubscribeType type = SubscribeType::RESPONSE;
251     std::shared_ptr<FuzzResponseListenerImpl> listener = std::make_shared<FuzzResponseListenerImpl>();
252     RequestManager::GetInstance()->AddListener(taskId, type, listener);
253     type = SubscribeType::COMPLETED;
254     std::shared_ptr<FuzzNotifyDataListenerImpl> listener2 = std::make_shared<FuzzNotifyDataListenerImpl>();
255     RequestManager::GetInstance()->AddListener(taskId, type, listener2);
256     RequestManager::GetInstance()->RemoveAllListeners(taskId);
257     RequestManager::GetInstance()->RestoreListener(nullptr);
258 }
259 
TestFunc(void)260 void TestFunc(void)
261 {
262     return;
263 }
264 
RestoreListenerRequestFuzzTest(const uint8_t * data,size_t size)265 void RestoreListenerRequestFuzzTest(const uint8_t *data, size_t size)
266 {
267     GrantNativePermission();
268     std::string tid(reinterpret_cast<const char *>(data), size);
269     RequestManager::GetInstance()->Start(tid);
270     RequestManager::GetInstance()->RestoreListener(TestFunc);
271 }
272 
QueryRequestFuzzTest(const uint8_t * data,size_t size)273 void QueryRequestFuzzTest(const uint8_t *data, size_t size)
274 {
275     std::string tid(reinterpret_cast<const char *>(data), size);
276     TaskInfo taskinfo;
277     GrantNativePermission();
278     RequestManager::GetInstance()->Query(tid, taskinfo);
279 }
280 
RequestFuzzTestGetId(const uint8_t * data,size_t size)281 void RequestFuzzTestGetId(const uint8_t *data, size_t size)
282 {
283     std::string tid(reinterpret_cast<const char *>(data), size);
284     GrantNativePermission();
285     auto request = OHOS::Request::Request(tid);
286     request.getId();
287 }
288 
RequestFuzzTestHasListener(const uint8_t * data,size_t size)289 void RequestFuzzTestHasListener(const uint8_t *data, size_t size)
290 {
291     std::string tid(reinterpret_cast<const char *>(data), size);
292     SubscribeType type = SubscribeType::RESPONSE;
293     auto request = OHOS::Request::Request(tid);
294     std::shared_ptr<FuzzResponseListenerImpl> listenerPtr = std::make_shared<FuzzResponseListenerImpl>();
295     GrantNativePermission();
296     request.AddListener(type, listenerPtr);
297     request.HasListener();
298     request.RemoveListener(type, listenerPtr);
299 }
300 
RequestFuzzTestOnNotifyDataReceive(const uint8_t * data,size_t size)301 void RequestFuzzTestOnNotifyDataReceive(const uint8_t *data, size_t size)
302 {
303     std::string tid(reinterpret_cast<const char *>(data), size);
304     SubscribeType type = SubscribeType::COMPLETED;
305     auto request = OHOS::Request::Request(tid);
306     std::shared_ptr<NotifyData> notifyData = std::make_shared<NotifyData>();
307     notifyData->type = type;
308     notifyData->version = Version::API9;
309     GrantNativePermission();
310     request.OnNotifyDataReceive(notifyData);
311     std::shared_ptr<FuzzNotifyDataListenerImpl> listenerPtr = std::make_shared<FuzzNotifyDataListenerImpl>();
312     request.AddListener(type, listenerPtr);
313     request.OnNotifyDataReceive(notifyData);
314 }
315 
RequestFuzzTestAddAndRemoveListener(const uint8_t * data,size_t size)316 void RequestFuzzTestAddAndRemoveListener(const uint8_t *data, size_t size)
317 {
318     std::string tid(reinterpret_cast<const char *>(data), size);
319     SubscribeType type = SubscribeType::COMPLETED;
320     GrantNativePermission();
321     auto request = OHOS::Request::Request(tid);
322     std::shared_ptr<NotifyData> notifyData = std::make_shared<NotifyData>();
323     notifyData->type = type;
324     notifyData->version = Version::API9;
325 
326     request.OnNotifyDataReceive(notifyData);
327     std::shared_ptr<FuzzNotifyDataListenerImpl> listenerPtr = std::make_shared<FuzzNotifyDataListenerImpl>();
328     request.AddListener(type, listenerPtr);
329     request.RemoveListener(type, listenerPtr);
330 }
331 
RequestFuzzTestOnResponseReceive(const uint8_t * data,size_t size)332 void RequestFuzzTestOnResponseReceive(const uint8_t *data, size_t size)
333 {
334     std::string tid(reinterpret_cast<const char *>(data), size);
335     SubscribeType type = SubscribeType::RESPONSE;
336     std::shared_ptr<Response> response = std::make_shared<Response>();
337     GrantNativePermission();
338     auto request = OHOS::Request::Request(tid);
339     request.OnResponseReceive(response);
340     std::shared_ptr<FuzzResponseListenerImpl> listenerPtr = std::make_shared<FuzzResponseListenerImpl>();
341     request.AddListener(type, listenerPtr);
342     request.OnResponseReceive(response);
343 }
344 
345 class FuzzFwkTestOberver : public IRunningTaskObserver {
346 public:
347     void OnRunningTaskCountUpdate(int count) override;
348     ~FuzzFwkTestOberver() = default;
349     FuzzFwkTestOberver() = default;
350 };
351 
OnRunningTaskCountUpdate(int count)352 void FuzzFwkTestOberver::OnRunningTaskCountUpdate(int count)
353 {
354 }
355 
RunningTaskCountFuzzTestSubscribeRunningTaskCount(const uint8_t * data,size_t size)356 void RunningTaskCountFuzzTestSubscribeRunningTaskCount(const uint8_t *data, size_t size)
357 {
358     GrantNativePermission();
359     auto proxy = RequestManagerImpl::GetInstance()->GetRequestServiceProxy(true);
360     if (proxy == nullptr) {
361         std::shared_ptr<IRunningTaskObserver> ob = std::make_shared<FuzzFwkTestOberver>();
362         ob->OnRunningTaskCountUpdate(static_cast<int>(*data));
363         SubscribeRunningTaskCount(ob);
364         UnsubscribeRunningTaskCount(ob);
365     }
366     std::shared_ptr<IRunningTaskObserver> ob1 = std::make_shared<FuzzFwkTestOberver>();
367     SubscribeRunningTaskCount(ob1);
368     std::shared_ptr<IRunningTaskObserver> ob2 = std::make_shared<FuzzFwkTestOberver>();
369     FwkRunningTaskCountManager::GetInstance()->AttachObserver(ob2);
370     SubscribeRunningTaskCount(ob2);
371     FwkRunningTaskCountManager::GetInstance()->DetachObserver(ob1);
372     FwkRunningTaskCountManager::GetInstance()->DetachObserver(ob2);
373 }
374 
RunningTaskCountFuzzTestUnubscribeRunning(const uint8_t * data,size_t size)375 void RunningTaskCountFuzzTestUnubscribeRunning(const uint8_t *data, size_t size)
376 {
377     GrantNativePermission();
378     std::shared_ptr<IRunningTaskObserver> ob1 = std::make_shared<FuzzFwkTestOberver>();
379     FwkRunningTaskCountManager::GetInstance()->AttachObserver(ob1);
380     ob1->OnRunningTaskCountUpdate(static_cast<int>(*data));
381 
382     std::shared_ptr<IRunningTaskObserver> ob2 = std::make_shared<FuzzFwkTestOberver>();
383     UnsubscribeRunningTaskCount(ob2);
384     UnsubscribeRunningTaskCount(ob1);
385 }
386 
RunningTaskCountFuzzTestGetAndSetCount(const uint8_t * data,size_t size)387 void RunningTaskCountFuzzTestGetAndSetCount(const uint8_t *data, size_t size)
388 {
389     GrantNativePermission();
390     int old = static_cast<int>(*data);
391     int except = 1; // 10 is except count num
392     FwkRunningTaskCountManager::GetInstance()->SetCount(except);
393     FwkRunningTaskCountManager::GetInstance()->GetCount();
394     FwkRunningTaskCountManager::GetInstance()->SetCount(old);
395     FwkRunningTaskCountManager::GetInstance()->GetCount();
396 }
397 
RunningTaskCountFuzzTestUpdateRunningTaskCount(const uint8_t * data,size_t size)398 void RunningTaskCountFuzzTestUpdateRunningTaskCount(const uint8_t *data, size_t size)
399 {
400     GrantNativePermission();
401     std::shared_ptr<IRunningTaskObserver> ob = std::make_shared<FuzzFwkTestOberver>();
402     ob->OnRunningTaskCountUpdate(static_cast<int>(*data));
403     FwkIRunningTaskObserver runningOb = FwkIRunningTaskObserver(ob);
404     runningOb.UpdateRunningTaskCount();
405 }
406 
RunningTaskCountFuzzTestNotifyAllObservers(const uint8_t * data,size_t size)407 void RunningTaskCountFuzzTestNotifyAllObservers(const uint8_t *data, size_t size)
408 {
409     GrantNativePermission();
410     std::shared_ptr<IRunningTaskObserver> ob1 = std::make_shared<FuzzFwkTestOberver>();
411     FwkRunningTaskCountManager::GetInstance()->AttachObserver(ob1);
412     FwkRunningTaskCountManager::GetInstance()->NotifyAllObservers();
413     FwkRunningTaskCountManager::GetInstance()->DetachObserver(ob1);
414     ob1->OnRunningTaskCountUpdate(static_cast<int>(*data));
415 }
416 
RunCountNotifyStubFuzzTestGetInstanceDoneCallBack(const uint8_t * data,size_t size)417 void RunCountNotifyStubFuzzTestGetInstanceDoneCallBack(const uint8_t *data, size_t size)
418 {
419     TaskInfo taskInfo;
420     taskInfo.tid = std::string(reinterpret_cast<const char *>(data), size);
421     Notify notify;
422     GrantNativePermission();
423 
424     RunCountNotifyStub::GetInstance();
425     RunCountNotifyStub::GetInstance()->Done(taskInfo);
426     RunCountNotifyStub::GetInstance()->CallBack(notify);
427 }
428 
RunCountNotifyStubFuzzTestOnCallBack(const uint8_t * data,size_t size)429 void RunCountNotifyStubFuzzTestOnCallBack(const uint8_t *data, size_t size)
430 {
431     int64_t except = static_cast<int64_t>(*data);
432     int old = FwkRunningTaskCountManager::GetInstance()->GetCount();
433     OHOS::MessageParcel parcel;
434     parcel.WriteInt64(except);
435     GrantNativePermission();
436     RunCountNotifyStub::GetInstance()->OnCallBack(parcel);
437     FwkRunningTaskCountManager::GetInstance()->GetCount();
438     FwkRunningTaskCountManager::GetInstance()->SetCount(old);
439     FwkRunningTaskCountManager::GetInstance()->GetCount();
440 }
441 
442 static constexpr int32_t ARRAY_LEN = 256; // 128 is array length
443 static constexpr int32_t INT64_SIZE = 8;  // 8 is int64 and uint64 num length
444 static constexpr int32_t INT32_SIZE = 4;  // 4 is int32 and uint32 num length
445 static constexpr int32_t INT16_SIZE = 2;  // 2 is int16 and uint16 num length
446 
ResponseMessageFuzzTestInt64FromParcel(const uint8_t * data,size_t size)447 void ResponseMessageFuzzTestInt64FromParcel(const uint8_t *data, size_t size)
448 {
449     int64_t except = static_cast<int64_t>(*data);
450     char *parcel = reinterpret_cast<char *>(&except);
451     int64_t num;
452     int testSize = INT32_SIZE;
453     ResponseMessageReceiver::Int64FromParcel(num, parcel, testSize);
454     testSize = INT64_SIZE;
455     ResponseMessageReceiver::Int64FromParcel(num, parcel, testSize);
456 }
457 
ResponseMessageFuzzTestUint64FromParcel(const uint8_t * data,size_t size)458 void ResponseMessageFuzzTestUint64FromParcel(const uint8_t *data, size_t size)
459 {
460     uint64_t except = static_cast<uint64_t>(*data);
461     char *parcel = reinterpret_cast<char *>(&except);
462     uint64_t num;
463     int testSize = INT32_SIZE;
464     ResponseMessageReceiver::Uint64FromParcel(num, parcel, testSize);
465     testSize = INT64_SIZE;
466     ResponseMessageReceiver::Uint64FromParcel(num, parcel, testSize);
467 }
468 
ResponseMessageFuzzTestInt32FromParcel(const uint8_t * data,size_t size)469 void ResponseMessageFuzzTestInt32FromParcel(const uint8_t *data, size_t size)
470 {
471     int32_t except = static_cast<int32_t>(*data);
472     char *parcel = reinterpret_cast<char *>(&except);
473     int32_t num;
474     int testSize = INT16_SIZE;
475     ResponseMessageReceiver::Int32FromParcel(num, parcel, testSize);
476     testSize = INT32_SIZE;
477     ResponseMessageReceiver::Int32FromParcel(num, parcel, testSize);
478 }
479 
ResponseMessageFuzzTestUint32FromParcel(const uint8_t * data,size_t size)480 void ResponseMessageFuzzTestUint32FromParcel(const uint8_t *data, size_t size)
481 {
482     uint32_t except = static_cast<uint32_t>(*data);
483     char *parcel = reinterpret_cast<char *>(&except);
484     uint32_t num;
485     int testSize = INT16_SIZE;
486     ResponseMessageReceiver::Uint32FromParcel(num, parcel, testSize);
487     testSize = INT32_SIZE;
488     ResponseMessageReceiver::Uint32FromParcel(num, parcel, testSize);
489 }
490 
ResponseMessageFuzzTestInt16FromParcel(const uint8_t * data,size_t size)491 void ResponseMessageFuzzTestInt16FromParcel(const uint8_t *data, size_t size)
492 {
493     int16_t except = static_cast<int16_t>(*data);
494     char *parcel = reinterpret_cast<char *>(&except);
495     int16_t num;
496     int testSize = 0;
497     ResponseMessageReceiver::Int16FromParcel(num, parcel, testSize);
498     testSize = INT16_SIZE;
499     ResponseMessageReceiver::Int16FromParcel(num, parcel, testSize);
500 }
501 
ResponseMessageFuzzTestStateFromParcel(const uint8_t * data,size_t size)502 void ResponseMessageFuzzTestStateFromParcel(const uint8_t *data, size_t size)
503 {
504     State state = static_cast<State>(*data);
505     uint32_t except = static_cast<uint32_t>(State::ANY) + 1;
506     char *parcel = reinterpret_cast<char *>(&except);
507     int testSize = INT32_SIZE;
508     ResponseMessageReceiver::StateFromParcel(state, parcel, testSize);
509     except = static_cast<uint32_t>(State::ANY);
510     parcel = reinterpret_cast<char *>(&except);
511     testSize = INT32_SIZE;
512     ResponseMessageReceiver::StateFromParcel(state, parcel, testSize);
513 }
514 
ResponseMessageFuzzTestActionFromParcel(const uint8_t * data,size_t size)515 void ResponseMessageFuzzTestActionFromParcel(const uint8_t *data, size_t size)
516 {
517     Action action = static_cast<Action>(*data);
518     uint32_t except = static_cast<uint32_t>(Action::ANY) + 1;
519     char *parcel = reinterpret_cast<char *>(&except);
520     int testSize = INT32_SIZE;
521     ResponseMessageReceiver::ActionFromParcel(action, parcel, testSize);
522     except = static_cast<uint32_t>(Action::ANY);
523     parcel = reinterpret_cast<char *>(&except);
524     testSize = INT32_SIZE;
525     ResponseMessageReceiver::ActionFromParcel(action, parcel, testSize);
526 }
527 
ResponseMessageFuzzTestVersionFromParcel(const uint8_t * data,size_t size)528 void ResponseMessageFuzzTestVersionFromParcel(const uint8_t *data, size_t size)
529 {
530     Version version = static_cast<Version>(*data);
531     uint32_t except = static_cast<uint32_t>(Version::API10) + 1;
532     char *parcel = reinterpret_cast<char *>(&except);
533     int testSize = INT32_SIZE;
534     ResponseMessageReceiver::VersionFromParcel(version, parcel, testSize);
535     except = static_cast<uint32_t>(Version::API10);
536     parcel = reinterpret_cast<char *>(&except);
537     testSize = INT32_SIZE;
538     ResponseMessageReceiver::VersionFromParcel(version, parcel, testSize);
539 }
540 
ResponseMessageFuzzTestSubscribeTypeFromParcel(const uint8_t * data,size_t size)541 void ResponseMessageFuzzTestSubscribeTypeFromParcel(const uint8_t *data, size_t size)
542 {
543     SubscribeType type = static_cast<SubscribeType>(*data);
544     uint32_t except = static_cast<uint32_t>(SubscribeType::BUTT) + 1;
545     char *parcel = reinterpret_cast<char *>(&except);
546     int testSize = INT32_SIZE;
547     ResponseMessageReceiver::SubscribeTypeFromParcel(type, parcel, testSize);
548     except = static_cast<uint32_t>(SubscribeType::BUTT);
549     parcel = reinterpret_cast<char *>(&except);
550     testSize = INT32_SIZE;
551     ResponseMessageReceiver::SubscribeTypeFromParcel(type, parcel, testSize);
552 }
553 
ResponseMessageFuzzTestStringFromParcel(const uint8_t * data,size_t size)554 void ResponseMessageFuzzTestStringFromParcel(const uint8_t *data, size_t size)
555 {
556     std::string str;
557     std::string except(reinterpret_cast<const char *>(data), size);
558     char *parcel = const_cast<char *>(except.c_str());
559     int testSize = except.size() - 1;
560     ResponseMessageReceiver::StringFromParcel(str, parcel, testSize);
561     testSize = except.size() + 1;
562     ResponseMessageReceiver::StringFromParcel(str, parcel, testSize);
563 }
564 
ResponseMessageFuzzTestResponseHeaderFromParcel(const uint8_t * data,size_t size)565 void ResponseMessageFuzzTestResponseHeaderFromParcel(const uint8_t *data, size_t size)
566 {
567     std::map<std::string, std::vector<std::string>> headers;
568     std::string except = "header:aaa,bbb,ccc\n";
569     char *parcel = const_cast<char *>(except.c_str());
570     int testSize = except.size();
571     ResponseMessageReceiver::ResponseHeaderFromParcel(headers, parcel, testSize);
572     std::string str(reinterpret_cast<const char *>(data), size);
573     parcel = const_cast<char *>(str.c_str());
574     testSize = except.size();
575     ResponseMessageReceiver::ResponseHeaderFromParcel(headers, parcel, testSize);
576 }
577 
ResponseMessageFuzzTestProgressExtrasFromParcel(const uint8_t * data,size_t size)578 void ResponseMessageFuzzTestProgressExtrasFromParcel(const uint8_t *data, size_t size)
579 {
580     int arraySize = 64; // 64 is char array length
581     char except[arraySize];
582     uint32_t length = static_cast<uint32_t>(*data);
583     int ret = memcpy_s(except, static_cast<size_t>(arraySize), reinterpret_cast<void *>(&length), sizeof(length));
584     if (ret != 0) {
585         return;
586     }
587     char keyValue[] = "key\0value\0";
588     ret = memcpy_s(except + sizeof(length), static_cast<size_t>(arraySize - sizeof(length)), keyValue,
589         9); // 9 is keyValue length
590     if (ret != 0) {
591         return;
592     }
593     std::map<std::string, std::string> extras;
594     char *parcel = except;
595     int testSize = INT16_SIZE;
596     ResponseMessageReceiver::ProgressExtrasFromParcel(extras, parcel, testSize);
597     parcel = except;
598     testSize = sizeof(length) + 1;
599     ResponseMessageReceiver::ProgressExtrasFromParcel(extras, parcel, testSize);
600     parcel = except;
601     testSize = sizeof(length) + 6; // 6 make except testSize between the keyValue
602     ResponseMessageReceiver::ProgressExtrasFromParcel(extras, parcel, testSize);
603     parcel = except;
604     testSize = arraySize;
605     ResponseMessageReceiver::ProgressExtrasFromParcel(extras, parcel, testSize);
606 }
607 
ResponseMessageFuzzTestVecInt64FromParcel(const uint8_t * data,size_t size)608 void ResponseMessageFuzzTestVecInt64FromParcel(const uint8_t *data, size_t size)
609 {
610     int arraySize = INT32_SIZE + INT64_SIZE;
611     char except[arraySize];
612     uint32_t length = static_cast<uint32_t>(*data);
613     int ret = memcpy_s(except, static_cast<size_t>(arraySize), reinterpret_cast<void *>(&length), sizeof(length));
614     if (ret != 0) {
615         return;
616     }
617     int64_t value = 123456; // 123456 is except num
618     ret = memcpy_s(except + sizeof(length), static_cast<size_t>(arraySize - sizeof(length)),
619         reinterpret_cast<void *>(&value), sizeof(value));
620     if (ret != 0) {
621         return;
622     }
623     std::vector<int64_t> vec;
624     char *parcel = except;
625     int testSize = INT16_SIZE;
626     ResponseMessageReceiver::VecInt64FromParcel(vec, parcel, testSize);
627     parcel = except;
628     testSize = INT64_SIZE;
629     ResponseMessageReceiver::VecInt64FromParcel(vec, parcel, testSize);
630     parcel = except;
631     testSize = arraySize; // 6 make except testSize between the keyValue
632     ResponseMessageReceiver::VecInt64FromParcel(vec, parcel, testSize);
633 }
634 
ResponseMessageFuzzTestResponseMessageReceiver(const uint8_t * data,size_t size)635 void ResponseMessageFuzzTestResponseMessageReceiver(const uint8_t *data, size_t size)
636 {
637     IResponseMessageHandler *handler = nullptr;
638     int32_t sockFd = static_cast<int32_t>(*data);
639     ResponseMessageReceiver receiver = ResponseMessageReceiver(handler, sockFd);
640 }
641 
ResponseMessageFuzzTestMsgHeaderParcel(const uint8_t * data,size_t size)642 void ResponseMessageFuzzTestMsgHeaderParcel(const uint8_t *data, size_t size)
643 {
644     uint32_t magicNum = ResponseMessageReceiver::RESPONSE_MAGIC_NUM - 1;
645     int pos = 0;
646     int arraySize = INT32_SIZE + INT64_SIZE;
647     char except[arraySize];
648     int ret = memcpy_s(except, static_cast<size_t>(arraySize), reinterpret_cast<void *>(&magicNum), sizeof(magicNum));
649     if (ret != 0) {
650         return;
651     }
652     pos += sizeof(magicNum);
653     int32_t msgId = static_cast<int32_t>(*data);
654     ret = memcpy_s(except + pos, static_cast<size_t>(arraySize - pos), reinterpret_cast<void *>(&msgId), sizeof(msgId));
655     if (ret != 0) {
656         return;
657     }
658     pos += sizeof(msgId);
659     int16_t msgType = 123; // 123 is except num
660     ret = memcpy_s(
661         except + pos, static_cast<size_t>(arraySize - pos), reinterpret_cast<void *>(&msgType), sizeof(msgType));
662     if (ret != 0) {
663         return;
664     }
665     pos += sizeof(msgType);
666     int16_t bodySize = 456; // 456 is except num
667     ret = memcpy_s(
668         except + pos, static_cast<size_t>(arraySize - pos), reinterpret_cast<void *>(&bodySize), sizeof(bodySize));
669     if (ret != 0) {
670         return;
671     }
672     pos += sizeof(bodySize);
673     msgId = 0;
674     msgType = 0;
675     bodySize = 0;
676     char *parcel = except;
677     int testSize = INT16_SIZE;
678     ResponseMessageReceiver::MsgHeaderParcel(msgId, msgType, bodySize, parcel, testSize);
679     parcel = except;
680     testSize = INT32_SIZE;
681     ResponseMessageReceiver::MsgHeaderParcel(msgId, msgType, bodySize, parcel, testSize);
682     parcel = except;
683     testSize = INT32_SIZE;
684     magicNum = ResponseMessageReceiver::RESPONSE_MAGIC_NUM;
685     ret = memcpy_s(except, static_cast<size_t>(arraySize), reinterpret_cast<void *>(&magicNum), sizeof(magicNum));
686     if (ret != 0) {
687         return;
688     }
689     ResponseMessageReceiver::MsgHeaderParcel(msgId, msgType, bodySize, parcel, testSize);
690     parcel = except;
691     testSize = INT32_SIZE + INT16_SIZE;
692     ResponseMessageReceiver::MsgHeaderParcel(msgId, msgType, bodySize, parcel, testSize);
693     parcel = except;
694     testSize = INT64_SIZE;
695     ResponseMessageReceiver::MsgHeaderParcel(msgId, msgType, bodySize, parcel, testSize); // 123456 is except num
696     parcel = except;
697     testSize = INT64_SIZE + INT16_SIZE;
698     ResponseMessageReceiver::MsgHeaderParcel(msgId, msgType, bodySize, parcel, testSize);
699     parcel = except;
700     testSize = arraySize;
701     ResponseMessageReceiver::MsgHeaderParcel(msgId, msgType, bodySize, parcel, testSize);
702 }
703 
ResponseMessageFuzzTestResponseFromParcel(const uint8_t * data,size_t size)704 void ResponseMessageFuzzTestResponseFromParcel(const uint8_t *data, size_t size)
705 {
706     std::shared_ptr<Response> response = std::make_shared<Response>();
707     int pos = 0;
708     int32_t tid = static_cast<int32_t>(*data);
709     std::string version = "version";
710     int32_t statusCode = 456; // 456 is except statusCode
711     std::string reason = "reason";
712     std::string headers = "header:aaa,bbb,ccc\n";
713     char except[ARRAY_LEN];
714     int ret = memcpy_s(except, static_cast<size_t>(ARRAY_LEN), reinterpret_cast<void *>(&tid), sizeof(tid));
715     if (ret != 0) {
716         return;
717     }
718     pos += sizeof(tid);
719     ret = memcpy_s(except + pos, static_cast<size_t>(ARRAY_LEN - pos), version.c_str(), version.size() + 1);
720     if (ret != 0) {
721         return;
722     }
723     pos += (version.size() + 1);
724     ret = memcpy_s(
725         except + pos, static_cast<size_t>(ARRAY_LEN - pos), reinterpret_cast<void *>(&statusCode), sizeof(statusCode));
726     if (ret != 0) {
727         return;
728     }
729     pos += sizeof(statusCode);
730     ret = memcpy_s(except + pos, static_cast<size_t>(ARRAY_LEN - pos), reason.c_str(), reason.size() + 1);
731     if (ret != 0) {
732         return;
733     }
734     pos += (reason.size() + 1);
735     ret = memcpy_s(except + pos, static_cast<size_t>(ARRAY_LEN - pos), headers.c_str(), headers.size() + 1);
736     if (ret != 0) {
737         return;
738     }
739     pos += (headers.size() + 1);
740     char *parcel = except;
741     int testSize = INT16_SIZE;
742     ResponseMessageReceiver::ResponseFromParcel(response, parcel, testSize);
743     parcel = except;
744     testSize = INT32_SIZE;
745     ResponseMessageReceiver::ResponseFromParcel(response, parcel, testSize);
746     parcel = except;
747     testSize = INT32_SIZE + version.size() + 1;
748     ResponseMessageReceiver::ResponseFromParcel(response, parcel, testSize);
749     parcel = except;
750     testSize = INT64_SIZE + version.size() + 1;
751     ResponseMessageReceiver::ResponseFromParcel(response, parcel, testSize);
752     parcel = except;
753     testSize = ARRAY_LEN;
754     ResponseMessageReceiver::ResponseFromParcel(response, parcel, testSize);
755 }
756 
ResponseMessageFuzzTestTaskStatesFromParcel(const uint8_t * data,size_t size)757 void ResponseMessageFuzzTestTaskStatesFromParcel(const uint8_t *data, size_t size)
758 {
759     std::vector<TaskState> taskStates;
760     int pos = 0;
761     int32_t length = static_cast<int32_t>(*data);
762     std::string path = "path";
763     int32_t responseCode = NETWORK_OFFLINE;
764     std::string message = "message";
765     char except[ARRAY_LEN];
766     int ret = memcpy_s(except, static_cast<size_t>(ARRAY_LEN), reinterpret_cast<void *>(&length), sizeof(length));
767     if (ret != 0) {
768         return;
769     }
770     pos += sizeof(length);
771     ret = memcpy_s(except + pos, static_cast<size_t>(ARRAY_LEN - pos), path.c_str(), path.size() + 1);
772     if (ret != 0) {
773         return;
774     }
775     pos += (path.size() + 1);
776     ret = memcpy_s(except + pos, static_cast<size_t>(ARRAY_LEN - pos), reinterpret_cast<void *>(&responseCode),
777         sizeof(responseCode));
778     if (ret != 0) {
779         return;
780     }
781     pos += sizeof(responseCode);
782     ret = memcpy_s(except + pos, static_cast<size_t>(ARRAY_LEN - pos), message.c_str(), message.size() + 1);
783     if (ret != 0) {
784         return;
785     }
786     pos += (message.size() + 1);
787     char *parcel = except;
788     int testSize = INT16_SIZE;
789     ResponseMessageReceiver::TaskStatesFromParcel(taskStates, parcel, testSize);
790     parcel = except;
791     testSize = INT32_SIZE;
792     ResponseMessageReceiver::TaskStatesFromParcel(taskStates, parcel, testSize);
793     parcel = except;
794     testSize = INT32_SIZE + path.size() + 1;
795     ResponseMessageReceiver::TaskStatesFromParcel(taskStates, parcel, testSize);
796     parcel = except;
797     testSize = INT64_SIZE + path.size() + 1;
798     ResponseMessageReceiver::TaskStatesFromParcel(taskStates, parcel, testSize);
799     parcel = except;
800     testSize = ARRAY_LEN;
801     ResponseMessageReceiver::TaskStatesFromParcel(taskStates, parcel, testSize);
802 }
803 
ResponseMessageFuzzTestNotifyDataFromParcel(const uint8_t * data,size_t size)804 void ResponseMessageFuzzTestNotifyDataFromParcel(const uint8_t *data, size_t size)
805 {
806     std::shared_ptr<NotifyData> notifyData = std::make_shared<NotifyData>();
807     int pos = 0;
808     int32_t length = static_cast<int32_t>(*data);
809     SubscribeType type = SubscribeType::BUTT;
810     uint32_t taskId = 123; // 123 is except tid
811     State state = State::ANY;
812     uint32_t index = 456;             // 456 is except index
813     uint64_t processed = 123456;      // 123456 is except processed
814     uint64_t totalProcessed = 111222; // 111222 is except totalProcessed
815     int64_t value = 333444;           // 333444 is except num
816     int ketValueLen = 10;             //9 is keyValue length
817     char keyValue[] = "key\0value\0";
818     Action action = Action::UPLOAD;
819     Version version = Version::API10;
820     std::string path = "path";
821     int32_t responseCode = NETWORK_OFFLINE;
822     std::string message = "message";
823     char except[ARRAY_LEN];
824     int ret = memcpy_s(except, static_cast<size_t>(ARRAY_LEN), reinterpret_cast<void *>(&type), sizeof(type));
825     if (ret != 0) {
826         return;
827     }
828     pos += sizeof(type);
829     ret = memcpy_s(
830         except + pos, static_cast<size_t>(ARRAY_LEN - pos), reinterpret_cast<void *>(&taskId), sizeof(taskId));
831     if (ret != 0) {
832         return;
833     }
834     pos += sizeof(taskId);
835     ret = memcpy_s(except + pos, static_cast<size_t>(ARRAY_LEN - pos), reinterpret_cast<void *>(&state), sizeof(state));
836     if (ret != 0) {
837         return;
838     }
839     pos += sizeof(state);
840     ret = memcpy_s(except + pos, static_cast<size_t>(ARRAY_LEN - pos), reinterpret_cast<void *>(&index), sizeof(index));
841     if (ret != 0) {
842         return;
843     }
844     pos += sizeof(index);
845     ret = memcpy_s(
846         except + pos, static_cast<size_t>(ARRAY_LEN - pos), reinterpret_cast<void *>(&processed), sizeof(processed));
847     if (ret != 0) {
848         return;
849     }
850     pos += sizeof(processed);
851     ret = memcpy_s(except + pos, static_cast<size_t>(ARRAY_LEN - pos), reinterpret_cast<void *>(&totalProcessed),
852         sizeof(totalProcessed));
853     if (ret != 0) {
854         return;
855     }
856     pos += sizeof(totalProcessed);
857     ret = memcpy_s(
858         except + pos, static_cast<size_t>(ARRAY_LEN - pos), reinterpret_cast<void *>(&length), sizeof(length));
859     if (ret != 0) {
860         return;
861     }
862     pos += sizeof(length);
863     ret = memcpy_s(except + pos, static_cast<size_t>(ARRAY_LEN - pos), reinterpret_cast<void *>(&value), sizeof(value));
864     if (ret != 0) {
865         return;
866     }
867     pos += sizeof(value);
868     ret = memcpy_s(
869         except + pos, static_cast<size_t>(ARRAY_LEN - pos), reinterpret_cast<void *>(&length), sizeof(length));
870     if (ret != 0) {
871         return;
872     }
873     pos += sizeof(length);
874     ret = memcpy_s(except + pos, static_cast<size_t>(ARRAY_LEN - pos), keyValue, ketValueLen);
875     if (ret != 0) {
876         return;
877     }
878     pos += ketValueLen;
879     ret = memcpy_s(
880         except + pos, static_cast<size_t>(ARRAY_LEN - pos), reinterpret_cast<void *>(&action), sizeof(action));
881     if (ret != 0) {
882         return;
883     }
884     pos += sizeof(action);
885     ret = memcpy_s(
886         except + pos, static_cast<size_t>(ARRAY_LEN - pos), reinterpret_cast<void *>(&version), sizeof(version));
887     if (ret != 0) {
888         return;
889     }
890     pos += sizeof(version);
891     ret = memcpy_s(
892         except + pos, static_cast<size_t>(ARRAY_LEN - pos), reinterpret_cast<void *>(&length), sizeof(length));
893     if (ret != 0) {
894         return;
895     }
896     pos += sizeof(length);
897     ret = memcpy_s(except + pos, static_cast<size_t>(ARRAY_LEN - pos), path.c_str(), path.size() + 1);
898     if (ret != 0) {
899         return;
900     }
901     pos += (path.size() + 1);
902     ret = memcpy_s(except + pos, static_cast<size_t>(ARRAY_LEN - pos), reinterpret_cast<void *>(&responseCode),
903         sizeof(responseCode));
904     if (ret != 0) {
905         return;
906     }
907     pos += sizeof(responseCode);
908     ret = memcpy_s(except + pos, static_cast<size_t>(ARRAY_LEN - pos), message.c_str(), message.size() + 1);
909     if (ret != 0) {
910         return;
911     }
912     pos += (message.size() + 1);
913     char *parcel = except;
914     int testSize = INT16_SIZE;
915     ResponseMessageReceiver::NotifyDataFromParcel(notifyData, parcel, testSize);
916     parcel = except;
917     testSize = INT32_SIZE;
918     int maxLen = testSize;
919     ResponseMessageReceiver::NotifyDataFromParcel(notifyData, parcel, testSize);
920     parcel = except;
921     maxLen += INT32_SIZE;
922     testSize = maxLen;
923     ResponseMessageReceiver::NotifyDataFromParcel(notifyData, parcel, testSize);
924     parcel = except;
925     maxLen += INT32_SIZE;
926     testSize = maxLen;
927     ResponseMessageReceiver::NotifyDataFromParcel(notifyData, parcel, testSize);
928     parcel = except;
929     maxLen += INT32_SIZE;
930     testSize = maxLen;
931     ResponseMessageReceiver::NotifyDataFromParcel(notifyData, parcel, testSize);
932     parcel = except;
933     maxLen += INT64_SIZE;
934     testSize = maxLen;
935     ResponseMessageReceiver::NotifyDataFromParcel(notifyData, parcel, testSize);
936     parcel = except;
937     maxLen += INT64_SIZE;
938     testSize = maxLen;
939     ResponseMessageReceiver::NotifyDataFromParcel(notifyData, parcel, testSize);
940     parcel = except;
941     maxLen += (sizeof(length) + sizeof(value));
942     testSize = maxLen;
943     ResponseMessageReceiver::NotifyDataFromParcel(notifyData, parcel, testSize);
944     parcel = except;
945     maxLen += (sizeof(length) + ketValueLen);
946     testSize = maxLen;
947     ResponseMessageReceiver::NotifyDataFromParcel(notifyData, parcel, testSize);
948     parcel = except;
949     maxLen += INT32_SIZE;
950     testSize = maxLen;
951     ResponseMessageReceiver::NotifyDataFromParcel(notifyData, parcel, testSize);
952     parcel = except;
953     maxLen += INT32_SIZE;
954     testSize = maxLen;
955     ResponseMessageReceiver::NotifyDataFromParcel(notifyData, parcel, testSize);
956     parcel = except;
957     testSize = ARRAY_LEN;
958     ResponseMessageReceiver::NotifyDataFromParcel(notifyData, parcel, testSize);
959 }
960 
961 class FuzzRemoteObjectImpl : public OHOS::IRemoteObject {};
962 
963 } // namespace OHOS
964 
965 /* Fuzzer entry point */
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)966 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
967 {
968     /* Run your code on data */
969     OHOS::CreateRequestFuzzTest(data, size);
970     OHOS::StartRequestFuzzTest(data, size);
971     OHOS::StopRequestFuzzTest(data, size);
972     OHOS::ShowRequestFuzzTest(data, size);
973     OHOS::TouchRequestFuzzTest(data, size);
974     OHOS::SearchRequestFuzzTest(data, size);
975     OHOS::PauseRequestFuzzTest(data, size);
976     OHOS::QueryMimeTypeRequestFuzzTest(data, size);
977     OHOS::RemoveRequestFuzzTest(data, size);
978     OHOS::ResumeRequestFuzzTest(data, size);
979     OHOS::GetTaskRequestFuzzTest(data, size);
980     OHOS::SubscribeRequestFuzzTest(data, size);
981     OHOS::UnsubscribeRequestFuzzTest(data, size);
982     OHOS::RestoreListenerRequestFuzzTest(data, size);
983     OHOS::IsSaReadyRequestFuzzTest(data, size);
984     OHOS::ReopenChannelRequestFuzzTest(data, size);
985     OHOS::SubscribeSARequestFuzzTest(data, size);
986     OHOS::AddAndRemoveListenerRequestFuzzTest(data, size);
987     OHOS::RemoveAllListenersRequestFuzzTest(data, size);
988     OHOS::QueryRequestFuzzTest(data, size);
989     OHOS::RequestFuzzTestGetId(data, size);
990     OHOS::RequestFuzzTestHasListener(data, size);
991     OHOS::RequestFuzzTestOnNotifyDataReceive(data, size);
992     OHOS::RequestFuzzTestAddAndRemoveListener(data, size);
993     OHOS::RequestFuzzTestOnResponseReceive(data, size);
994     OHOS::RunningTaskCountFuzzTestSubscribeRunningTaskCount(data, size);
995     OHOS::RunningTaskCountFuzzTestUnubscribeRunning(data, size);
996     OHOS::RunningTaskCountFuzzTestGetAndSetCount(data, size);
997     OHOS::RunningTaskCountFuzzTestUpdateRunningTaskCount(data, size);
998     OHOS::RunningTaskCountFuzzTestNotifyAllObservers(data, size);
999     OHOS::RunCountNotifyStubFuzzTestGetInstanceDoneCallBack(data, size);
1000     OHOS::RunCountNotifyStubFuzzTestOnCallBack(data, size);
1001     OHOS::ResponseMessageFuzzTestInt64FromParcel(data, size);
1002     OHOS::ResponseMessageFuzzTestUint64FromParcel(data, size);
1003     OHOS::ResponseMessageFuzzTestInt32FromParcel(data, size);
1004     OHOS::ResponseMessageFuzzTestUint32FromParcel(data, size);
1005     OHOS::ResponseMessageFuzzTestInt16FromParcel(data, size);
1006     OHOS::ResponseMessageFuzzTestStateFromParcel(data, size);
1007     OHOS::ResponseMessageFuzzTestActionFromParcel(data, size);
1008     OHOS::ResponseMessageFuzzTestVersionFromParcel(data, size);
1009     OHOS::ResponseMessageFuzzTestSubscribeTypeFromParcel(data, size);
1010     OHOS::ResponseMessageFuzzTestStringFromParcel(data, size);
1011     OHOS::ResponseMessageFuzzTestResponseHeaderFromParcel(data, size);
1012     OHOS::ResponseMessageFuzzTestProgressExtrasFromParcel(data, size);
1013     OHOS::ResponseMessageFuzzTestVecInt64FromParcel(data, size);
1014     OHOS::ResponseMessageFuzzTestResponseMessageReceiver(data, size);
1015     OHOS::ResponseMessageFuzzTestMsgHeaderParcel(data, size);
1016     OHOS::ResponseMessageFuzzTestResponseFromParcel(data, size);
1017     OHOS::ResponseMessageFuzzTestTaskStatesFromParcel(data, size);
1018     OHOS::ResponseMessageFuzzTestNotifyDataFromParcel(data, size);
1019     return 0;
1020 }
1021