From a6eea334adc0642d3007666c4b6c1b5223ad3ef7 Mon Sep 17 00:00:00 2001 From: SivaLee Date: Mon, 31 Oct 2022 11:48:03 +0800 Subject: [PATCH] add fuzz testcase Signed-off-by: SivaLee Change-Id: I74bbb7b06a3e9390c6894f522c9d9323cb46fbeb --- test/fuzztest/BUILD.gn | 38 ++++++++++++++ .../dispatchprotocolmessage_fuzzer/BUILD.gn | 1 - .../dispatchprotocolmessage_fuzzer.cpp | 6 +-- .../initializedebugger_fuzzer/BUILD.gn | 1 - test/fuzztest/protocolhandler_fuzzer/BUILD.gn | 43 +++++++++++++++ .../protocolhandler_fuzzer/corpus/init | 14 +++++ .../protocolhandler_fuzzer/project.xml | 25 +++++++++ .../protocolhandler_fuzzer.cpp | 48 +++++++++++++++++ .../protocolhandler_fuzzer.h | 21 ++++++++ .../protocolhandlerdispatch_fuzzer/BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../protocolhandlerdispatch_fuzzer.cpp | 50 ++++++++++++++++++ .../protocolhandlerdispatch_fuzzer.h | 21 ++++++++ .../protocolhandlerget_fuzzer/BUILD.gn | 43 +++++++++++++++ .../protocolhandlerget_fuzzer/corpus/init | 14 +++++ .../protocolhandlerget_fuzzer/project.xml | 25 +++++++++ .../protocolhandlerget_fuzzer.cpp | 49 +++++++++++++++++ .../protocolhandlerget_fuzzer.h | 21 ++++++++ .../protocolhandlernotif_fuzzer/BUILD.gn | 43 +++++++++++++++ .../protocolhandlernotif_fuzzer/corpus/init | 14 +++++ .../protocolhandlernotif_fuzzer/project.xml | 25 +++++++++ .../protocolhandlernotif_fuzzer.cpp | 50 ++++++++++++++++++ .../protocolhandlernotif_fuzzer.h | 21 ++++++++ .../protocolhandlerprocess_fuzzer/BUILD.gn | 43 +++++++++++++++ .../protocolhandlerprocess_fuzzer/corpus/init | 14 +++++ .../protocolhandlerprocess_fuzzer/project.xml | 25 +++++++++ .../protocolhandlerprocess_fuzzer.cpp | 49 +++++++++++++++++ .../protocolhandlerprocess_fuzzer.h | 21 ++++++++ .../protocolhandlerresponse_fuzzer/BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../protocolhandlerresponse_fuzzer.cpp | 52 +++++++++++++++++++ .../protocolhandlerresponse_fuzzer.h | 21 ++++++++ .../protocolhandlerrun_fuzzer/BUILD.gn | 43 +++++++++++++++ .../protocolhandlerrun_fuzzer/corpus/init | 14 +++++ .../protocolhandlerrun_fuzzer/project.xml | 25 +++++++++ .../protocolhandlerrun_fuzzer.cpp | 49 +++++++++++++++++ .../protocolhandlerrun_fuzzer.h | 21 ++++++++ .../protocolhandlerwait_fuzzer/BUILD.gn | 43 +++++++++++++++ .../protocolhandlerwait_fuzzer/corpus/init | 14 +++++ .../protocolhandlerwait_fuzzer/project.xml | 25 +++++++++ .../protocolhandlerwait_fuzzer.cpp | 49 +++++++++++++++++ .../protocolhandlerwait_fuzzer.h | 21 ++++++++ .../pttypesbreakpointparseid_fuzzer/BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesbreakpointparseid_fuzzer.cpp | 46 ++++++++++++++++ .../pttypesbreakpointparseid_fuzzer.h | 21 ++++++++ .../pttypesbreakpointtostring_fuzzer/BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesbreakpointtostring_fuzzer.cpp | 45 ++++++++++++++++ .../pttypesbreakpointtostring_fuzzer.h | 21 ++++++++ .../pttypesexceptiondetails_fuzzer/BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesexceptiondetails_fuzzer.cpp | 45 ++++++++++++++++ .../pttypesexceptiondetails_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesexceptiondetailscolumn_fuzzer.cpp | 47 +++++++++++++++++ .../pttypesexceptiondetailscolumn_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesexceptiondetailscreate_fuzzer.cpp | 50 ++++++++++++++++++ .../pttypesexceptiondetailscreate_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ ...ttypesexceptiondetailsexception_fuzzer.cpp | 48 +++++++++++++++++ .../pttypesexceptiondetailsexception_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ ...ypesexceptiondetailsexceptionid_fuzzer.cpp | 47 +++++++++++++++++ ...ttypesexceptiondetailsexceptionid_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ ...eptiondetailsexecutioncontextid_fuzzer.cpp | 48 +++++++++++++++++ ...xceptiondetailsexecutioncontextid_fuzzer.h | 21 ++++++++ .../BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesexceptiondetailsline_fuzzer.cpp | 47 +++++++++++++++++ .../pttypesexceptiondetailsline_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ ...pttypesexceptiondetailsscriptid_fuzzer.cpp | 48 +++++++++++++++++ .../pttypesexceptiondetailsscriptid_fuzzer.h | 21 ++++++++ .../BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesexceptiondetailstext_fuzzer.cpp | 46 ++++++++++++++++ .../pttypesexceptiondetailstext_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesexceptiondetailstojson_fuzzer.cpp | 45 ++++++++++++++++ .../pttypesexceptiondetailstojson_fuzzer.h | 21 ++++++++ .../BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesexceptiondetailsurl_fuzzer.cpp | 47 +++++++++++++++++ .../pttypesexceptiondetailsurl_fuzzer.h | 21 ++++++++ .../BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesfunctionremoteobject_fuzzer.cpp | 45 ++++++++++++++++ .../pttypesfunctionremoteobject_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ ...esgeneratorfunctionremoteobject_fuzzer.cpp | 44 ++++++++++++++++ ...ypesgeneratorfunctionremoteobject_fuzzer.h | 21 ++++++++ .../pttypesobjectremoteobject_fuzzer/BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesobjectremoteobject_fuzzer.cpp | 47 +++++++++++++++++ .../pttypesobjectremoteobject_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesprimitiveremoteobject_fuzzer.cpp | 44 ++++++++++++++++ .../pttypesprimitiveremoteobject_fuzzer.h | 21 ++++++++ .../pttypesremoteobject_fuzzer/BUILD.gn | 43 +++++++++++++++ .../pttypesremoteobject_fuzzer/corpus/init | 14 +++++ .../pttypesremoteobject_fuzzer/project.xml | 25 +++++++++ .../pttypesremoteobject_fuzzer.cpp | 44 ++++++++++++++++ .../pttypesremoteobject_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesremoteobjectdescription_fuzzer.cpp | 47 +++++++++++++++++ .../pttypesremoteobjectdescription_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ ...pttypesremoteobjectgetclassname_fuzzer.cpp | 46 ++++++++++++++++ .../pttypesremoteobjectgetclassname_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesremoteobjectgetsubtype_fuzzer.cpp | 46 ++++++++++++++++ .../pttypesremoteobjectgetsubtype_fuzzer.h | 21 ++++++++ .../BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesremoteobjectgettype_fuzzer.cpp | 45 ++++++++++++++++ .../pttypesremoteobjectgettype_fuzzer.h | 21 ++++++++ .../BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesremoteobjectgetvalue_fuzzer.cpp | 49 +++++++++++++++++ .../pttypesremoteobjectgetvalue_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ ...pttypesremoteobjecthasclassname_fuzzer.cpp | 45 ++++++++++++++++ .../pttypesremoteobjecthasclassname_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesremoteobjecthassubtype_fuzzer.cpp | 45 ++++++++++++++++ .../pttypesremoteobjecthassubtype_fuzzer.h | 21 ++++++++ .../BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesremoteobjectobjectid_fuzzer.cpp | 48 +++++++++++++++++ .../pttypesremoteobjectobjectid_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ ...pttypesremoteobjectsetclassname_fuzzer.cpp | 45 ++++++++++++++++ .../pttypesremoteobjectsetclassname_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesremoteobjectsetsubtype_fuzzer.cpp | 45 ++++++++++++++++ .../pttypesremoteobjectsetsubtype_fuzzer.h | 21 ++++++++ .../BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesremoteobjectsettype_fuzzer.cpp | 45 ++++++++++++++++ .../pttypesremoteobjectsettype_fuzzer.h | 21 ++++++++ .../BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesremoteobjectsetvalue_fuzzer.cpp | 46 ++++++++++++++++ .../pttypesremoteobjectsetvalue_fuzzer.h | 21 ++++++++ .../BUILD.gn | 42 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ ...remoteobjectunserializablevalue_fuzzer.cpp | 48 +++++++++++++++++ ...esremoteobjectunserializablevalue_fuzzer.h | 21 ++++++++ .../pttypesstringremoteobject_fuzzer/BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypesstringremoteobject_fuzzer.cpp | 44 ++++++++++++++++ .../pttypesstringremoteobject_fuzzer.h | 21 ++++++++ .../pttypessymbolremoteobject_fuzzer/BUILD.gn | 43 +++++++++++++++ .../corpus/init | 14 +++++ .../project.xml | 25 +++++++++ .../pttypessymbolremoteobject_fuzzer.cpp | 44 ++++++++++++++++ .../pttypessymbolremoteobject_fuzzer.h | 21 ++++++++ 209 files changed, 6164 insertions(+), 5 deletions(-) create mode 100644 test/fuzztest/protocolhandler_fuzzer/BUILD.gn create mode 100644 test/fuzztest/protocolhandler_fuzzer/corpus/init create mode 100644 test/fuzztest/protocolhandler_fuzzer/project.xml create mode 100644 test/fuzztest/protocolhandler_fuzzer/protocolhandler_fuzzer.cpp create mode 100644 test/fuzztest/protocolhandler_fuzzer/protocolhandler_fuzzer.h create mode 100644 test/fuzztest/protocolhandlerdispatch_fuzzer/BUILD.gn create mode 100644 test/fuzztest/protocolhandlerdispatch_fuzzer/corpus/init create mode 100644 test/fuzztest/protocolhandlerdispatch_fuzzer/project.xml create mode 100644 test/fuzztest/protocolhandlerdispatch_fuzzer/protocolhandlerdispatch_fuzzer.cpp create mode 100644 test/fuzztest/protocolhandlerdispatch_fuzzer/protocolhandlerdispatch_fuzzer.h create mode 100644 test/fuzztest/protocolhandlerget_fuzzer/BUILD.gn create mode 100644 test/fuzztest/protocolhandlerget_fuzzer/corpus/init create mode 100644 test/fuzztest/protocolhandlerget_fuzzer/project.xml create mode 100644 test/fuzztest/protocolhandlerget_fuzzer/protocolhandlerget_fuzzer.cpp create mode 100644 test/fuzztest/protocolhandlerget_fuzzer/protocolhandlerget_fuzzer.h create mode 100644 test/fuzztest/protocolhandlernotif_fuzzer/BUILD.gn create mode 100644 test/fuzztest/protocolhandlernotif_fuzzer/corpus/init create mode 100644 test/fuzztest/protocolhandlernotif_fuzzer/project.xml create mode 100644 test/fuzztest/protocolhandlernotif_fuzzer/protocolhandlernotif_fuzzer.cpp create mode 100644 test/fuzztest/protocolhandlernotif_fuzzer/protocolhandlernotif_fuzzer.h create mode 100644 test/fuzztest/protocolhandlerprocess_fuzzer/BUILD.gn create mode 100644 test/fuzztest/protocolhandlerprocess_fuzzer/corpus/init create mode 100644 test/fuzztest/protocolhandlerprocess_fuzzer/project.xml create mode 100644 test/fuzztest/protocolhandlerprocess_fuzzer/protocolhandlerprocess_fuzzer.cpp create mode 100644 test/fuzztest/protocolhandlerprocess_fuzzer/protocolhandlerprocess_fuzzer.h create mode 100644 test/fuzztest/protocolhandlerresponse_fuzzer/BUILD.gn create mode 100644 test/fuzztest/protocolhandlerresponse_fuzzer/corpus/init create mode 100644 test/fuzztest/protocolhandlerresponse_fuzzer/project.xml create mode 100644 test/fuzztest/protocolhandlerresponse_fuzzer/protocolhandlerresponse_fuzzer.cpp create mode 100644 test/fuzztest/protocolhandlerresponse_fuzzer/protocolhandlerresponse_fuzzer.h create mode 100644 test/fuzztest/protocolhandlerrun_fuzzer/BUILD.gn create mode 100644 test/fuzztest/protocolhandlerrun_fuzzer/corpus/init create mode 100644 test/fuzztest/protocolhandlerrun_fuzzer/project.xml create mode 100644 test/fuzztest/protocolhandlerrun_fuzzer/protocolhandlerrun_fuzzer.cpp create mode 100644 test/fuzztest/protocolhandlerrun_fuzzer/protocolhandlerrun_fuzzer.h create mode 100644 test/fuzztest/protocolhandlerwait_fuzzer/BUILD.gn create mode 100644 test/fuzztest/protocolhandlerwait_fuzzer/corpus/init create mode 100644 test/fuzztest/protocolhandlerwait_fuzzer/project.xml create mode 100644 test/fuzztest/protocolhandlerwait_fuzzer/protocolhandlerwait_fuzzer.cpp create mode 100644 test/fuzztest/protocolhandlerwait_fuzzer/protocolhandlerwait_fuzzer.h create mode 100644 test/fuzztest/pttypesbreakpointparseid_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesbreakpointparseid_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesbreakpointparseid_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesbreakpointparseid_fuzzer/pttypesbreakpointparseid_fuzzer.cpp create mode 100644 test/fuzztest/pttypesbreakpointparseid_fuzzer/pttypesbreakpointparseid_fuzzer.h create mode 100644 test/fuzztest/pttypesbreakpointtostring_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesbreakpointtostring_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesbreakpointtostring_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesbreakpointtostring_fuzzer/pttypesbreakpointtostring_fuzzer.cpp create mode 100644 test/fuzztest/pttypesbreakpointtostring_fuzzer/pttypesbreakpointtostring_fuzzer.h create mode 100644 test/fuzztest/pttypesexceptiondetails_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesexceptiondetails_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesexceptiondetails_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesexceptiondetails_fuzzer/pttypesexceptiondetails_fuzzer.cpp create mode 100644 test/fuzztest/pttypesexceptiondetails_fuzzer/pttypesexceptiondetails_fuzzer.h create mode 100644 test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/pttypesexceptiondetailscolumn_fuzzer.cpp create mode 100644 test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/pttypesexceptiondetailscolumn_fuzzer.h create mode 100644 test/fuzztest/pttypesexceptiondetailscreate_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesexceptiondetailscreate_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesexceptiondetailscreate_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.cpp create mode 100644 test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.h create mode 100644 test/fuzztest/pttypesexceptiondetailsexception_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesexceptiondetailsexception_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesexceptiondetailsexception_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesexceptiondetailsexception_fuzzer/pttypesexceptiondetailsexception_fuzzer.cpp create mode 100644 test/fuzztest/pttypesexceptiondetailsexception_fuzzer/pttypesexceptiondetailsexception_fuzzer.h create mode 100644 test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/pttypesexceptiondetailsexceptionid_fuzzer.cpp create mode 100644 test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/pttypesexceptiondetailsexceptionid_fuzzer.h create mode 100644 test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/pttypesexceptiondetailsexecutioncontextid_fuzzer.cpp create mode 100644 test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/pttypesexceptiondetailsexecutioncontextid_fuzzer.h create mode 100644 test/fuzztest/pttypesexceptiondetailsline_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesexceptiondetailsline_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesexceptiondetailsline_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesexceptiondetailsline_fuzzer/pttypesexceptiondetailsline_fuzzer.cpp create mode 100644 test/fuzztest/pttypesexceptiondetailsline_fuzzer/pttypesexceptiondetailsline_fuzzer.h create mode 100644 test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/pttypesexceptiondetailsscriptid_fuzzer.cpp create mode 100644 test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/pttypesexceptiondetailsscriptid_fuzzer.h create mode 100644 test/fuzztest/pttypesexceptiondetailstext_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesexceptiondetailstext_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesexceptiondetailstext_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesexceptiondetailstext_fuzzer/pttypesexceptiondetailstext_fuzzer.cpp create mode 100644 test/fuzztest/pttypesexceptiondetailstext_fuzzer/pttypesexceptiondetailstext_fuzzer.h create mode 100644 test/fuzztest/pttypesexceptiondetailstojson_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesexceptiondetailstojson_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesexceptiondetailstojson_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesexceptiondetailstojson_fuzzer/pttypesexceptiondetailstojson_fuzzer.cpp create mode 100644 test/fuzztest/pttypesexceptiondetailstojson_fuzzer/pttypesexceptiondetailstojson_fuzzer.h create mode 100644 test/fuzztest/pttypesexceptiondetailsurl_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesexceptiondetailsurl_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesexceptiondetailsurl_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesexceptiondetailsurl_fuzzer/pttypesexceptiondetailsurl_fuzzer.cpp create mode 100644 test/fuzztest/pttypesexceptiondetailsurl_fuzzer/pttypesexceptiondetailsurl_fuzzer.h create mode 100644 test/fuzztest/pttypesfunctionremoteobject_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesfunctionremoteobject_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesfunctionremoteobject_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesfunctionremoteobject_fuzzer/pttypesfunctionremoteobject_fuzzer.cpp create mode 100644 test/fuzztest/pttypesfunctionremoteobject_fuzzer/pttypesfunctionremoteobject_fuzzer.h create mode 100644 test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/pttypesgeneratorfunctionremoteobject_fuzzer.cpp create mode 100644 test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/pttypesgeneratorfunctionremoteobject_fuzzer.h create mode 100644 test/fuzztest/pttypesobjectremoteobject_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesobjectremoteobject_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesobjectremoteobject_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesobjectremoteobject_fuzzer/pttypesobjectremoteobject_fuzzer.cpp create mode 100644 test/fuzztest/pttypesobjectremoteobject_fuzzer/pttypesobjectremoteobject_fuzzer.h create mode 100644 test/fuzztest/pttypesprimitiveremoteobject_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesprimitiveremoteobject_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesprimitiveremoteobject_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesprimitiveremoteobject_fuzzer/pttypesprimitiveremoteobject_fuzzer.cpp create mode 100644 test/fuzztest/pttypesprimitiveremoteobject_fuzzer/pttypesprimitiveremoteobject_fuzzer.h create mode 100644 test/fuzztest/pttypesremoteobject_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesremoteobject_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesremoteobject_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesremoteobject_fuzzer/pttypesremoteobject_fuzzer.cpp create mode 100644 test/fuzztest/pttypesremoteobject_fuzzer/pttypesremoteobject_fuzzer.h create mode 100644 test/fuzztest/pttypesremoteobjectdescription_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesremoteobjectdescription_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesremoteobjectdescription_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesremoteobjectdescription_fuzzer/pttypesremoteobjectdescription_fuzzer.cpp create mode 100644 test/fuzztest/pttypesremoteobjectdescription_fuzzer/pttypesremoteobjectdescription_fuzzer.h create mode 100644 test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/pttypesremoteobjectgetclassname_fuzzer.cpp create mode 100644 test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/pttypesremoteobjectgetclassname_fuzzer.h create mode 100644 test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/pttypesremoteobjectgetsubtype_fuzzer.cpp create mode 100644 test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/pttypesremoteobjectgetsubtype_fuzzer.h create mode 100644 test/fuzztest/pttypesremoteobjectgettype_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesremoteobjectgettype_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesremoteobjectgettype_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesremoteobjectgettype_fuzzer/pttypesremoteobjectgettype_fuzzer.cpp create mode 100644 test/fuzztest/pttypesremoteobjectgettype_fuzzer/pttypesremoteobjectgettype_fuzzer.h create mode 100644 test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/pttypesremoteobjectgetvalue_fuzzer.cpp create mode 100644 test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/pttypesremoteobjectgetvalue_fuzzer.h create mode 100644 test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/pttypesremoteobjecthasclassname_fuzzer.cpp create mode 100644 test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/pttypesremoteobjecthasclassname_fuzzer.h create mode 100644 test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/pttypesremoteobjecthassubtype_fuzzer.cpp create mode 100644 test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/pttypesremoteobjecthassubtype_fuzzer.h create mode 100644 test/fuzztest/pttypesremoteobjectobjectid_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesremoteobjectobjectid_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesremoteobjectobjectid_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesremoteobjectobjectid_fuzzer/pttypesremoteobjectobjectid_fuzzer.cpp create mode 100644 test/fuzztest/pttypesremoteobjectobjectid_fuzzer/pttypesremoteobjectobjectid_fuzzer.h create mode 100644 test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/pttypesremoteobjectsetclassname_fuzzer.cpp create mode 100644 test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/pttypesremoteobjectsetclassname_fuzzer.h create mode 100644 test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/pttypesremoteobjectsetsubtype_fuzzer.cpp create mode 100644 test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/pttypesremoteobjectsetsubtype_fuzzer.h create mode 100644 test/fuzztest/pttypesremoteobjectsettype_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesremoteobjectsettype_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesremoteobjectsettype_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesremoteobjectsettype_fuzzer/pttypesremoteobjectsettype_fuzzer.cpp create mode 100644 test/fuzztest/pttypesremoteobjectsettype_fuzzer/pttypesremoteobjectsettype_fuzzer.h create mode 100644 test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/pttypesremoteobjectsetvalue_fuzzer.cpp create mode 100644 test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/pttypesremoteobjectsetvalue_fuzzer.h create mode 100644 test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/pttypesremoteobjectunserializablevalue_fuzzer.cpp create mode 100644 test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/pttypesremoteobjectunserializablevalue_fuzzer.h create mode 100644 test/fuzztest/pttypesstringremoteobject_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypesstringremoteobject_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypesstringremoteobject_fuzzer/project.xml create mode 100644 test/fuzztest/pttypesstringremoteobject_fuzzer/pttypesstringremoteobject_fuzzer.cpp create mode 100644 test/fuzztest/pttypesstringremoteobject_fuzzer/pttypesstringremoteobject_fuzzer.h create mode 100644 test/fuzztest/pttypessymbolremoteobject_fuzzer/BUILD.gn create mode 100644 test/fuzztest/pttypessymbolremoteobject_fuzzer/corpus/init create mode 100644 test/fuzztest/pttypessymbolremoteobject_fuzzer/project.xml create mode 100644 test/fuzztest/pttypessymbolremoteobject_fuzzer/pttypessymbolremoteobject_fuzzer.cpp create mode 100644 test/fuzztest/pttypessymbolremoteobject_fuzzer/pttypessymbolremoteobject_fuzzer.h diff --git a/test/fuzztest/BUILD.gn b/test/fuzztest/BUILD.gn index 0746cd73..f4c9c8a6 100644 --- a/test/fuzztest/BUILD.gn +++ b/test/fuzztest/BUILD.gn @@ -18,5 +18,43 @@ group("fuzztest") { deps += [ "dispatchprotocolmessage_fuzzer:fuzztest", "initializedebugger_fuzzer:fuzztest", + "protocolhandler_fuzzer:fuzztest", + "protocolhandlerdispatch_fuzzer:fuzztest", + "protocolhandlerget_fuzzer:fuzztest", + "protocolhandlernotif_fuzzer:fuzztest", + "protocolhandlerprocess_fuzzer:fuzztest", + "protocolhandlerresponse_fuzzer:fuzztest", + "protocolhandlerrun_fuzzer:fuzztest", + "pttypesbreakpointparseid_fuzzer:fuzztest", + "pttypesbreakpointtostring_fuzzer:fuzztest", + "pttypesexceptiondetails_fuzzer:fuzztest", + "pttypesexceptiondetailscolumn_fuzzer:fuzztest", + "pttypesexceptiondetailscreate_fuzzer:fuzztest", + "pttypesexceptiondetailsexception_fuzzer:fuzztest", + "pttypesexceptiondetailsexceptionid_fuzzer:fuzztest", + "pttypesexceptiondetailsexecutioncontextid_fuzzer:fuzztest", + "pttypesexceptiondetailsline_fuzzer:fuzztest", + "pttypesexceptiondetailsscriptid_fuzzer:fuzztest", + "pttypesexceptiondetailstext_fuzzer:fuzztest", + "pttypesexceptiondetailstojson_fuzzer:fuzztest", + "pttypesexceptiondetailsurl_fuzzer:fuzztest", + "pttypesobjectremoteobject_fuzzer:fuzztest", + "pttypesprimitiveremoteobject_fuzzer:fuzztest", + "pttypesremoteobject_fuzzer:fuzztest", + "pttypesremoteobjectdescription_fuzzer:fuzztest", + "pttypesremoteobjectgetclassname_fuzzer:fuzztest", + "pttypesremoteobjectgetsubtype_fuzzer:fuzztest", + "pttypesremoteobjectgettype_fuzzer:fuzztest", + "pttypesremoteobjectgetvalue_fuzzer:fuzztest", + "pttypesremoteobjecthasclassname_fuzzer:fuzztest", + "pttypesremoteobjecthassubtype_fuzzer:fuzztest", + "pttypesremoteobjectobjectid_fuzzer:fuzztest", + "pttypesremoteobjectsetclassname_fuzzer:fuzztest", + "pttypesremoteobjectsetsubtype_fuzzer:fuzztest", + "pttypesremoteobjectsettype_fuzzer:fuzztest", + "pttypesremoteobjectsetvalue_fuzzer:fuzztest", + "pttypesremoteobjectunserializablevalue_fuzzer:fuzztest", + "pttypesstringremoteobject_fuzzer:fuzztest", + "pttypessymbolremoteobject_fuzzer:fuzztest", ] } diff --git a/test/fuzztest/dispatchprotocolmessage_fuzzer/BUILD.gn b/test/fuzztest/dispatchprotocolmessage_fuzzer/BUILD.gn index a1a6254e..cb592d95 100644 --- a/test/fuzztest/dispatchprotocolmessage_fuzzer/BUILD.gn +++ b/test/fuzztest/dispatchprotocolmessage_fuzzer/BUILD.gn @@ -12,7 +12,6 @@ # limitations under the License. ##################################hydra-fuzz################################### -# import("//arkcompiler/ets_runtime/js_runtime_config.gni") import("//arkcompiler/toolchain/test/test_helper.gni") import("//build/config/features.gni") import("//build/ohos.gni") diff --git a/test/fuzztest/dispatchprotocolmessage_fuzzer/dispatchprotocolmessage_fuzzer.cpp b/test/fuzztest/dispatchprotocolmessage_fuzzer/dispatchprotocolmessage_fuzzer.cpp index bff19b9e..5aab5385 100644 --- a/test/fuzztest/dispatchprotocolmessage_fuzzer/dispatchprotocolmessage_fuzzer.cpp +++ b/test/fuzztest/dispatchprotocolmessage_fuzzer/dispatchprotocolmessage_fuzzer.cpp @@ -27,11 +27,11 @@ namespace OHOS { RuntimeOption option; option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); auto vm = JSNApi::CreateJSVM(option); - if (size <= 0) { + if (size <= 0 || data == NULL) { return; } - std::string message(data, data+size); - OnMessage(vm, std::move(message)); + std::string message((const char*)data, size); + OnMessage(vm, message+"hello"); JSNApi::DestroyJSVM(vm); } } diff --git a/test/fuzztest/initializedebugger_fuzzer/BUILD.gn b/test/fuzztest/initializedebugger_fuzzer/BUILD.gn index cfde7f60..d9bb7786 100644 --- a/test/fuzztest/initializedebugger_fuzzer/BUILD.gn +++ b/test/fuzztest/initializedebugger_fuzzer/BUILD.gn @@ -12,7 +12,6 @@ # limitations under the License. #####################################hydra-fuzz############################### -# import("//arkcompiler/ets_runtime/js_runtime_config.gni") import("//arkcompiler/toolchain/test/test_helper.gni") import("//build/config/features.gni") import("//build/ohos.gni") diff --git a/test/fuzztest/protocolhandler_fuzzer/BUILD.gn b/test/fuzztest/protocolhandler_fuzzer/BUILD.gn new file mode 100644 index 00000000..76e4c4de --- /dev/null +++ b/test/fuzztest/protocolhandler_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("ProtocolHandlerFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/protocolhandler_fuzzer" + + sources = [ "protocolhandler_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ProtocolHandlerFuzzTest" ] +} diff --git a/test/fuzztest/protocolhandler_fuzzer/corpus/init b/test/fuzztest/protocolhandler_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/protocolhandler_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/protocolhandler_fuzzer/project.xml b/test/fuzztest/protocolhandler_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/protocolhandler_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/protocolhandler_fuzzer/protocolhandler_fuzzer.cpp b/test/fuzztest/protocolhandler_fuzzer/protocolhandler_fuzzer.cpp new file mode 100644 index 00000000..2a34b627 --- /dev/null +++ b/test/fuzztest/protocolhandler_fuzzer/protocolhandler_fuzzer.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "protocolhandler_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/protocol_handler.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void ProtocolHandlerFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0) { + return; + } + using ProtoHandler = const std::function; + ProtoHandler ph = [data, size](const void *d, [[maybe_unused]] const std::string &s) -> void { + d = data + size; + }; + ProtocolHandler handler(ph, vm); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::ProtocolHandlerFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/protocolhandler_fuzzer/protocolhandler_fuzzer.h b/test/fuzztest/protocolhandler_fuzzer/protocolhandler_fuzzer.h new file mode 100644 index 00000000..ffe25474 --- /dev/null +++ b/test/fuzztest/protocolhandler_fuzzer/protocolhandler_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "protocolhandler_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/protocolhandlerdispatch_fuzzer/BUILD.gn b/test/fuzztest/protocolhandlerdispatch_fuzzer/BUILD.gn new file mode 100644 index 00000000..9918bddc --- /dev/null +++ b/test/fuzztest/protocolhandlerdispatch_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("ProtocolHandlerDispatchFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/protocolhandlerdispatch_fuzzer" + + sources = [ "protocolhandlerdispatch_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ProtocolHandlerDispatchFuzzTest" ] +} diff --git a/test/fuzztest/protocolhandlerdispatch_fuzzer/corpus/init b/test/fuzztest/protocolhandlerdispatch_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/protocolhandlerdispatch_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/protocolhandlerdispatch_fuzzer/project.xml b/test/fuzztest/protocolhandlerdispatch_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/protocolhandlerdispatch_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/protocolhandlerdispatch_fuzzer/protocolhandlerdispatch_fuzzer.cpp b/test/fuzztest/protocolhandlerdispatch_fuzzer/protocolhandlerdispatch_fuzzer.cpp new file mode 100644 index 00000000..87dd99e3 --- /dev/null +++ b/test/fuzztest/protocolhandlerdispatch_fuzzer/protocolhandlerdispatch_fuzzer.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "protocolhandlerdispatch_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/protocol_handler.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void ProtocolHandlerDispatchFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0) { + return; + } + using ProtoHandler = const std::function; + ProtoHandler ph = [data, size](const void *d, [[maybe_unused]] const std::string &s) -> void { + d = data + size; + }; + ProtocolHandler handler(ph, vm); + std::string msg((const char*)data, size); + handler.DispatchCommand(msg + std::string("hello")); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::ProtocolHandlerDispatchFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/protocolhandlerdispatch_fuzzer/protocolhandlerdispatch_fuzzer.h b/test/fuzztest/protocolhandlerdispatch_fuzzer/protocolhandlerdispatch_fuzzer.h new file mode 100644 index 00000000..238ebbf6 --- /dev/null +++ b/test/fuzztest/protocolhandlerdispatch_fuzzer/protocolhandlerdispatch_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "protocolhandlerdispatch_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/protocolhandlerget_fuzzer/BUILD.gn b/test/fuzztest/protocolhandlerget_fuzzer/BUILD.gn new file mode 100644 index 00000000..a1c81f55 --- /dev/null +++ b/test/fuzztest/protocolhandlerget_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("ProtocolHandlerGetFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/protocolhandlerget_fuzzer" + + sources = [ "protocolhandlerget_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ProtocolHandlerGetFuzzTest" ] +} diff --git a/test/fuzztest/protocolhandlerget_fuzzer/corpus/init b/test/fuzztest/protocolhandlerget_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/protocolhandlerget_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/protocolhandlerget_fuzzer/project.xml b/test/fuzztest/protocolhandlerget_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/protocolhandlerget_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/protocolhandlerget_fuzzer/protocolhandlerget_fuzzer.cpp b/test/fuzztest/protocolhandlerget_fuzzer/protocolhandlerget_fuzzer.cpp new file mode 100644 index 00000000..2ad3c28e --- /dev/null +++ b/test/fuzztest/protocolhandlerget_fuzzer/protocolhandlerget_fuzzer.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "protocolhandlerget_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/protocol_handler.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void ProtocolHandlerGetFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0) { + return; + } + using ProtoHandler = const std::function; + ProtoHandler ph = [data, size](const void *d, [[maybe_unused]] const std::string &s) -> void { + d = data + size; + }; + ProtocolHandler handler(ph, vm); + handler.GetDispatchStatus(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::ProtocolHandlerGetFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/protocolhandlerget_fuzzer/protocolhandlerget_fuzzer.h b/test/fuzztest/protocolhandlerget_fuzzer/protocolhandlerget_fuzzer.h new file mode 100644 index 00000000..28575463 --- /dev/null +++ b/test/fuzztest/protocolhandlerget_fuzzer/protocolhandlerget_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "protocolhandlerget_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/protocolhandlernotif_fuzzer/BUILD.gn b/test/fuzztest/protocolhandlernotif_fuzzer/BUILD.gn new file mode 100644 index 00000000..80533060 --- /dev/null +++ b/test/fuzztest/protocolhandlernotif_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("ProtocolHandlerNotifFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/protocolhandlernotif_fuzzer" + + sources = [ "protocolhandlernotif_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ProtocolHandlerNotifFuzzTest" ] +} diff --git a/test/fuzztest/protocolhandlernotif_fuzzer/corpus/init b/test/fuzztest/protocolhandlernotif_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/protocolhandlernotif_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/protocolhandlernotif_fuzzer/project.xml b/test/fuzztest/protocolhandlernotif_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/protocolhandlernotif_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/protocolhandlernotif_fuzzer/protocolhandlernotif_fuzzer.cpp b/test/fuzztest/protocolhandlernotif_fuzzer/protocolhandlernotif_fuzzer.cpp new file mode 100644 index 00000000..6e91e46c --- /dev/null +++ b/test/fuzztest/protocolhandlernotif_fuzzer/protocolhandlernotif_fuzzer.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "protocolhandlernotif_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/protocol_handler.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void ProtocolHandlerNotifFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0) { + return; + } + using ProtoHandler = const std::function; + ProtoHandler ph = [data, size](const void *d, [[maybe_unused]] const std::string &s) -> void { + d = data + size; + }; + ProtocolHandler handler(ph, vm); + Paused event; + handler.SendNotification(event); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::ProtocolHandlerNotifFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/protocolhandlernotif_fuzzer/protocolhandlernotif_fuzzer.h b/test/fuzztest/protocolhandlernotif_fuzzer/protocolhandlernotif_fuzzer.h new file mode 100644 index 00000000..9aa24a1d --- /dev/null +++ b/test/fuzztest/protocolhandlernotif_fuzzer/protocolhandlernotif_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "protocolhandlernotif_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/protocolhandlerprocess_fuzzer/BUILD.gn b/test/fuzztest/protocolhandlerprocess_fuzzer/BUILD.gn new file mode 100644 index 00000000..7537b02d --- /dev/null +++ b/test/fuzztest/protocolhandlerprocess_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("ProtocolHandlerProcessFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/protocolhandlerprocess_fuzzer" + + sources = [ "protocolhandlerprocess_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ProtocolHandlerProcessFuzzTest" ] +} diff --git a/test/fuzztest/protocolhandlerprocess_fuzzer/corpus/init b/test/fuzztest/protocolhandlerprocess_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/protocolhandlerprocess_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/protocolhandlerprocess_fuzzer/project.xml b/test/fuzztest/protocolhandlerprocess_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/protocolhandlerprocess_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/protocolhandlerprocess_fuzzer/protocolhandlerprocess_fuzzer.cpp b/test/fuzztest/protocolhandlerprocess_fuzzer/protocolhandlerprocess_fuzzer.cpp new file mode 100644 index 00000000..926b91e1 --- /dev/null +++ b/test/fuzztest/protocolhandlerprocess_fuzzer/protocolhandlerprocess_fuzzer.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "protocolhandlerprocess_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/protocol_handler.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void ProtocolHandlerProcessFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0) { + return; + } + using ProtoHandler = const std::function; + ProtoHandler ph = [data, size](const void *d, [[maybe_unused]] const std::string &s) -> void { + d = data + size; + }; + ProtocolHandler handler(ph, vm); + handler.ProcessCommand(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::ProtocolHandlerProcessFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/protocolhandlerprocess_fuzzer/protocolhandlerprocess_fuzzer.h b/test/fuzztest/protocolhandlerprocess_fuzzer/protocolhandlerprocess_fuzzer.h new file mode 100644 index 00000000..ce0fe627 --- /dev/null +++ b/test/fuzztest/protocolhandlerprocess_fuzzer/protocolhandlerprocess_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "protocolhandlerprocess_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/protocolhandlerresponse_fuzzer/BUILD.gn b/test/fuzztest/protocolhandlerresponse_fuzzer/BUILD.gn new file mode 100644 index 00000000..06c49218 --- /dev/null +++ b/test/fuzztest/protocolhandlerresponse_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("ProtocolHandlerResponseFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/protocolhandlerresponse_fuzzer" + + sources = [ "protocolhandlerresponse_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ProtocolHandlerResponseFuzzTest" ] +} diff --git a/test/fuzztest/protocolhandlerresponse_fuzzer/corpus/init b/test/fuzztest/protocolhandlerresponse_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/protocolhandlerresponse_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/protocolhandlerresponse_fuzzer/project.xml b/test/fuzztest/protocolhandlerresponse_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/protocolhandlerresponse_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/protocolhandlerresponse_fuzzer/protocolhandlerresponse_fuzzer.cpp b/test/fuzztest/protocolhandlerresponse_fuzzer/protocolhandlerresponse_fuzzer.cpp new file mode 100644 index 00000000..0848d684 --- /dev/null +++ b/test/fuzztest/protocolhandlerresponse_fuzzer/protocolhandlerresponse_fuzzer.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "protocolhandlerresponse_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/protocol_handler.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void ProtocolHandlerResponseFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0) { + return; + } + using ProtoHandler = const std::function; + ProtoHandler ph = [data, size](const void *d, [[maybe_unused]] const std::string &s) -> void { + d = data + size; + }; + ProtocolHandler handler(ph, vm); + std::string str((const char*)data, size); + DispatchRequest req(str); + PtBaseReturns ret; + handler.SendResponse(req, DispatchResponse::Ok(), ret); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::ProtocolHandlerResponseFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/protocolhandlerresponse_fuzzer/protocolhandlerresponse_fuzzer.h b/test/fuzztest/protocolhandlerresponse_fuzzer/protocolhandlerresponse_fuzzer.h new file mode 100644 index 00000000..e1a2cce6 --- /dev/null +++ b/test/fuzztest/protocolhandlerresponse_fuzzer/protocolhandlerresponse_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "protocolhandlerresponse_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/protocolhandlerrun_fuzzer/BUILD.gn b/test/fuzztest/protocolhandlerrun_fuzzer/BUILD.gn new file mode 100644 index 00000000..eba00690 --- /dev/null +++ b/test/fuzztest/protocolhandlerrun_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("ProtocolHandlerRunFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/protocolhandlerrun_fuzzer" + + sources = [ "protocolhandlerrun_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ProtocolHandlerRunFuzzTest" ] +} diff --git a/test/fuzztest/protocolhandlerrun_fuzzer/corpus/init b/test/fuzztest/protocolhandlerrun_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/protocolhandlerrun_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/protocolhandlerrun_fuzzer/project.xml b/test/fuzztest/protocolhandlerrun_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/protocolhandlerrun_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/protocolhandlerrun_fuzzer/protocolhandlerrun_fuzzer.cpp b/test/fuzztest/protocolhandlerrun_fuzzer/protocolhandlerrun_fuzzer.cpp new file mode 100644 index 00000000..ff981660 --- /dev/null +++ b/test/fuzztest/protocolhandlerrun_fuzzer/protocolhandlerrun_fuzzer.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "protocolhandlerrun_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/protocol_handler.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void ProtocolHandlerRunFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0) { + return; + } + using ProtoHandler = const std::function; + ProtoHandler ph = [data, size](const void *d, [[maybe_unused]] const std::string &s) -> void { + d = data + size; + }; + ProtocolHandler handler(ph, vm); + handler.RunIfWaitingForDebugger(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::ProtocolHandlerRunFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/protocolhandlerrun_fuzzer/protocolhandlerrun_fuzzer.h b/test/fuzztest/protocolhandlerrun_fuzzer/protocolhandlerrun_fuzzer.h new file mode 100644 index 00000000..bb6044d5 --- /dev/null +++ b/test/fuzztest/protocolhandlerrun_fuzzer/protocolhandlerrun_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "protocolhandlerrun_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/protocolhandlerwait_fuzzer/BUILD.gn b/test/fuzztest/protocolhandlerwait_fuzzer/BUILD.gn new file mode 100644 index 00000000..0010a0c0 --- /dev/null +++ b/test/fuzztest/protocolhandlerwait_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("ProtocolHandlerWaitFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/protocolhandlerwait_fuzzer" + + sources = [ "protocolhandlerwait_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ProtocolHandlerWaitFuzzTest" ] +} diff --git a/test/fuzztest/protocolhandlerwait_fuzzer/corpus/init b/test/fuzztest/protocolhandlerwait_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/protocolhandlerwait_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/protocolhandlerwait_fuzzer/project.xml b/test/fuzztest/protocolhandlerwait_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/protocolhandlerwait_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/protocolhandlerwait_fuzzer/protocolhandlerwait_fuzzer.cpp b/test/fuzztest/protocolhandlerwait_fuzzer/protocolhandlerwait_fuzzer.cpp new file mode 100644 index 00000000..493b2124 --- /dev/null +++ b/test/fuzztest/protocolhandlerwait_fuzzer/protocolhandlerwait_fuzzer.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "protocolhandlerwait_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/protocol_handler.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void ProtocolHandlerWaitFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + using ProtoHandler = const std::function; + ProtoHandler ph = [data, size](const void *d, [[maybe_unused]] const std::string &s) -> void { + d = data + size; + }; + ProtocolHandler handler(ph, vm); + handler.WaitForDebugger(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::ProtocolHandlerWaitFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/protocolhandlerwait_fuzzer/protocolhandlerwait_fuzzer.h b/test/fuzztest/protocolhandlerwait_fuzzer/protocolhandlerwait_fuzzer.h new file mode 100644 index 00000000..f90f44e0 --- /dev/null +++ b/test/fuzztest/protocolhandlerwait_fuzzer/protocolhandlerwait_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "protocolhandlerwait_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesbreakpointparseid_fuzzer/BUILD.gn b/test/fuzztest/pttypesbreakpointparseid_fuzzer/BUILD.gn new file mode 100644 index 00000000..fd9c290c --- /dev/null +++ b/test/fuzztest/pttypesbreakpointparseid_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesBreakpointParseIdFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/pttypesbreakpointparseid_fuzzer" + + sources = [ "pttypesbreakpointparseid_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesBreakpointParseIdFuzzTest" ] +} diff --git a/test/fuzztest/pttypesbreakpointparseid_fuzzer/corpus/init b/test/fuzztest/pttypesbreakpointparseid_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesbreakpointparseid_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesbreakpointparseid_fuzzer/project.xml b/test/fuzztest/pttypesbreakpointparseid_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesbreakpointparseid_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesbreakpointparseid_fuzzer/pttypesbreakpointparseid_fuzzer.cpp b/test/fuzztest/pttypesbreakpointparseid_fuzzer/pttypesbreakpointparseid_fuzzer.cpp new file mode 100644 index 00000000..77fe9a7b --- /dev/null +++ b/test/fuzztest/pttypesbreakpointparseid_fuzzer/pttypesbreakpointparseid_fuzzer.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesbreakpointparseid_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesBreakpointParseIdFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0) { + return; + } + BreakpointDetails details = { .line_ = size, .column_ = size, .url_ = std::string((const char*)data, size)}; + BreakpointId id = BreakpointDetails::ToString(details); + BreakpointDetails::ParseBreakpointId(id, &details); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesBreakpointParseIdFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesbreakpointparseid_fuzzer/pttypesbreakpointparseid_fuzzer.h b/test/fuzztest/pttypesbreakpointparseid_fuzzer/pttypesbreakpointparseid_fuzzer.h new file mode 100644 index 00000000..5553c795 --- /dev/null +++ b/test/fuzztest/pttypesbreakpointparseid_fuzzer/pttypesbreakpointparseid_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesbreakpointparseid_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesbreakpointtostring_fuzzer/BUILD.gn b/test/fuzztest/pttypesbreakpointtostring_fuzzer/BUILD.gn new file mode 100644 index 00000000..7c4341ee --- /dev/null +++ b/test/fuzztest/pttypesbreakpointtostring_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesBreakpointToStringFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/pttypesbreakpointtostring_fuzzer" + + sources = [ "pttypesbreakpointtostring_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesBreakpointToStringFuzzTest" ] +} diff --git a/test/fuzztest/pttypesbreakpointtostring_fuzzer/corpus/init b/test/fuzztest/pttypesbreakpointtostring_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesbreakpointtostring_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesbreakpointtostring_fuzzer/project.xml b/test/fuzztest/pttypesbreakpointtostring_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesbreakpointtostring_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesbreakpointtostring_fuzzer/pttypesbreakpointtostring_fuzzer.cpp b/test/fuzztest/pttypesbreakpointtostring_fuzzer/pttypesbreakpointtostring_fuzzer.cpp new file mode 100644 index 00000000..4283e2e0 --- /dev/null +++ b/test/fuzztest/pttypesbreakpointtostring_fuzzer/pttypesbreakpointtostring_fuzzer.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesbreakpointtostring_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesBreakpointToStringFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0) { + return; + } + BreakpointDetails details = { .line_ = size, .column_ = size, .url_ = std::string((const char*)data, size)}; + BreakpointId id = BreakpointDetails::ToString(details); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesBreakpointToStringFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesbreakpointtostring_fuzzer/pttypesbreakpointtostring_fuzzer.h b/test/fuzztest/pttypesbreakpointtostring_fuzzer/pttypesbreakpointtostring_fuzzer.h new file mode 100644 index 00000000..e4f6f943 --- /dev/null +++ b/test/fuzztest/pttypesbreakpointtostring_fuzzer/pttypesbreakpointtostring_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesbreakpointtostring_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetails_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetails_fuzzer/BUILD.gn new file mode 100644 index 00000000..e63f82c8 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetails_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesExceptionDetailsFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/pttypesexceptiondetails_fuzzer" + + sources = [ "pttypesexceptiondetails_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesExceptionDetailsFuzzTest" ] +} diff --git a/test/fuzztest/pttypesexceptiondetails_fuzzer/corpus/init b/test/fuzztest/pttypesexceptiondetails_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetails_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesexceptiondetails_fuzzer/project.xml b/test/fuzztest/pttypesexceptiondetails_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetails_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetails_fuzzer/pttypesexceptiondetails_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetails_fuzzer/pttypesexceptiondetails_fuzzer.cpp new file mode 100644 index 00000000..e6c51055 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetails_fuzzer/pttypesexceptiondetails_fuzzer.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesexceptiondetails_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesExceptionDetailsFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + ExceptionDetails details; + + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesExceptionDetailsFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesexceptiondetails_fuzzer/pttypesexceptiondetails_fuzzer.h b/test/fuzztest/pttypesexceptiondetails_fuzzer/pttypesexceptiondetails_fuzzer.h new file mode 100644 index 00000000..7b031a6b --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetails_fuzzer/pttypesexceptiondetails_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesexceptiondetails_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/BUILD.gn new file mode 100644 index 00000000..121b4bfc --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesExceptionDetailsColumnFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer" + + sources = [ "pttypesexceptiondetailscolumn_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesExceptionDetailsColumnFuzzTest" ] +} diff --git a/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/corpus/init b/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/project.xml b/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/pttypesexceptiondetailscolumn_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/pttypesexceptiondetailscolumn_fuzzer.cpp new file mode 100644 index 00000000..7e27654e --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/pttypesexceptiondetailscolumn_fuzzer.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesexceptiondetailscolumn_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesExceptionDetailsColumnFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + int line = (int)*data; + ExceptionDetails details; + details.SetColumn(line); + details.GetColumn(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesExceptionDetailsColumnFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/pttypesexceptiondetailscolumn_fuzzer.h b/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/pttypesexceptiondetailscolumn_fuzzer.h new file mode 100644 index 00000000..74f3896e --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/pttypesexceptiondetailscolumn_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesexceptiondetailscolumn_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/BUILD.gn new file mode 100644 index 00000000..523a6305 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesExceptionDetailsCreateFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesexceptiondetailscreate_fuzzer" + + sources = [ "pttypesexceptiondetailscreate_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesExceptionDetailsCreateFuzzTest" ] +} diff --git a/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/corpus/init b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/project.xml b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.cpp new file mode 100644 index 00000000..7996ae3d --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesexceptiondetailscreate_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesExceptionDetailsCreateFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + cJSON* cjson = cJSON_ParseWithLength((const char*)data, size); + if (cjson != NULL) { + PtJson pjson(cjson); + auto details = ExceptionDetails::Create(pjson); + cJSON_Delete(cjson); + } + + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesExceptionDetailsCreateFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.h b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.h new file mode 100644 index 00000000..da149368 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesexceptiondetailscreate_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/BUILD.gn new file mode 100644 index 00000000..fc8e4fe5 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesExceptionDetailsExceptionFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesexceptiondetailsexception_fuzzer" + + sources = [ "pttypesexceptiondetailsexception_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesExceptionDetailsExceptionFuzzTest" ] +} diff --git a/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/corpus/init b/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/project.xml b/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/pttypesexceptiondetailsexception_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/pttypesexceptiondetailsexception_fuzzer.cpp new file mode 100644 index 00000000..dd3ffb24 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/pttypesexceptiondetailsexception_fuzzer.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesexceptiondetailsexception_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesExceptionDetailsExceptionFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + ExceptionDetails details; + std::unique_ptr obj = std::make_unique(); + details.SetException(std::move(obj)); + details.GetException(); + details.HasException(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesExceptionDetailsExceptionFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/pttypesexceptiondetailsexception_fuzzer.h b/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/pttypesexceptiondetailsexception_fuzzer.h new file mode 100644 index 00000000..2e08012e --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/pttypesexceptiondetailsexception_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesexceptiondetailsexception_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/BUILD.gn new file mode 100644 index 00000000..9e559ac1 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesExceptionDetailsExceptionIdFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer" + + sources = [ "pttypesexceptiondetailsexceptionid_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesExceptionDetailsExceptionIdFuzzTest" ] +} diff --git a/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/corpus/init b/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/project.xml b/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/pttypesexceptiondetailsexceptionid_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/pttypesexceptiondetailsexceptionid_fuzzer.cpp new file mode 100644 index 00000000..4cd252a9 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/pttypesexceptiondetailsexceptionid_fuzzer.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesexceptiondetailsexceptionid_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesExceptionDetailsExceptionIdFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + ExceptionDetails details; + int32_t id = (int32_t)*data; + details.SetExceptionId(id); + details.GetExceptionId(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesExceptionDetailsExceptionIdFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/pttypesexceptiondetailsexceptionid_fuzzer.h b/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/pttypesexceptiondetailsexceptionid_fuzzer.h new file mode 100644 index 00000000..23a195e9 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/pttypesexceptiondetailsexceptionid_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesexceptiondetailsexceptionid_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/BUILD.gn new file mode 100644 index 00000000..6733176e --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesExceptionDetailsExecutionContextIdFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer" + + sources = [ "pttypesexceptiondetailsexecutioncontextid_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesExceptionDetailsExecutionContextIdFuzzTest" ] +} diff --git a/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/corpus/init b/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/project.xml b/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/pttypesexceptiondetailsexecutioncontextid_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/pttypesexceptiondetailsexecutioncontextid_fuzzer.cpp new file mode 100644 index 00000000..ca7b1ea8 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/pttypesexceptiondetailsexecutioncontextid_fuzzer.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesexceptiondetailsexecutioncontextid_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesExceptionDetailsExecutionContextIdFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + ExceptionDetails details; + ExecutionContextId id = (ExecutionContextId)*data; + details.SetExecutionContextId(id); + details.GetExecutionContextId(); + details.HasExecutionContextId(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesExceptionDetailsExecutionContextIdFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/pttypesexceptiondetailsexecutioncontextid_fuzzer.h b/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/pttypesexceptiondetailsexecutioncontextid_fuzzer.h new file mode 100644 index 00000000..457fa4b2 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/pttypesexceptiondetailsexecutioncontextid_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesexceptiondetailsexecutioncontextid_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailsline_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailsline_fuzzer/BUILD.gn new file mode 100644 index 00000000..96a4d50a --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsline_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesExceptionDetailsLineFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/pttypesexceptiondetailsline_fuzzer" + + sources = [ "pttypesexceptiondetailsline_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesExceptionDetailsLineFuzzTest" ] +} diff --git a/test/fuzztest/pttypesexceptiondetailsline_fuzzer/corpus/init b/test/fuzztest/pttypesexceptiondetailsline_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsline_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesexceptiondetailsline_fuzzer/project.xml b/test/fuzztest/pttypesexceptiondetailsline_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsline_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailsline_fuzzer/pttypesexceptiondetailsline_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailsline_fuzzer/pttypesexceptiondetailsline_fuzzer.cpp new file mode 100644 index 00000000..34b5c4f6 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsline_fuzzer/pttypesexceptiondetailsline_fuzzer.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesexceptiondetailsline_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesExceptionDetailsLineFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + int line = (int) *data; + ExceptionDetails details; + details.SetLine(line); + details.GetLine(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesExceptionDetailsLineFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesexceptiondetailsline_fuzzer/pttypesexceptiondetailsline_fuzzer.h b/test/fuzztest/pttypesexceptiondetailsline_fuzzer/pttypesexceptiondetailsline_fuzzer.h new file mode 100644 index 00000000..7d5e3847 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsline_fuzzer/pttypesexceptiondetailsline_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesexceptiondetailsline_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/BUILD.gn new file mode 100644 index 00000000..e6526a44 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesExceptionDetailsScriptIdFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer" + + sources = [ "pttypesexceptiondetailsscriptid_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesExceptionDetailsScriptIdFuzzTest" ] +} diff --git a/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/corpus/init b/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/project.xml b/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/pttypesexceptiondetailsscriptid_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/pttypesexceptiondetailsscriptid_fuzzer.cpp new file mode 100644 index 00000000..a8e568fc --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/pttypesexceptiondetailsscriptid_fuzzer.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesexceptiondetailsscriptid_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesExceptionDetailsScriptIdFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + ScriptId id = (ScriptId)*data; + ExceptionDetails details; + details.SetScriptId(id); + details.GetScriptId(); + details.HasScriptId(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesExceptionDetailsScriptIdFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/pttypesexceptiondetailsscriptid_fuzzer.h b/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/pttypesexceptiondetailsscriptid_fuzzer.h new file mode 100644 index 00000000..517cd8f1 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/pttypesexceptiondetailsscriptid_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesexceptiondetailsscriptid_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailstext_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailstext_fuzzer/BUILD.gn new file mode 100644 index 00000000..77741d45 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailstext_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesExceptionDetailsTextFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/pttypesexceptiondetailstext_fuzzer" + + sources = [ "pttypesexceptiondetailstext_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesExceptionDetailsTextFuzzTest" ] +} diff --git a/test/fuzztest/pttypesexceptiondetailstext_fuzzer/corpus/init b/test/fuzztest/pttypesexceptiondetailstext_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailstext_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesexceptiondetailstext_fuzzer/project.xml b/test/fuzztest/pttypesexceptiondetailstext_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailstext_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailstext_fuzzer/pttypesexceptiondetailstext_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailstext_fuzzer/pttypesexceptiondetailstext_fuzzer.cpp new file mode 100644 index 00000000..a7449f7a --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailstext_fuzzer/pttypesexceptiondetailstext_fuzzer.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesexceptiondetailstext_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesExceptionDetailsTextFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + ExceptionDetails details; + details.SetText(std::string((const char*)data, size)); + details.GetText(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesExceptionDetailsTextFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesexceptiondetailstext_fuzzer/pttypesexceptiondetailstext_fuzzer.h b/test/fuzztest/pttypesexceptiondetailstext_fuzzer/pttypesexceptiondetailstext_fuzzer.h new file mode 100644 index 00000000..a076d41d --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailstext_fuzzer/pttypesexceptiondetailstext_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesexceptiondetailstext_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/BUILD.gn new file mode 100644 index 00000000..8b90d1a7 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesExceptionDetailsToJsonFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesexceptiondetailstojson_fuzzer" + + sources = [ "pttypesexceptiondetailstojson_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesExceptionDetailsToJsonFuzzTest" ] +} diff --git a/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/corpus/init b/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/project.xml b/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/pttypesexceptiondetailstojson_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/pttypesexceptiondetailstojson_fuzzer.cpp new file mode 100644 index 00000000..315db3fc --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/pttypesexceptiondetailstojson_fuzzer.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesexceptiondetailstojson_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesExceptionDetailsToJsonFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + ExceptionDetails details; + auto pj = details.ToJson(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesExceptionDetailsToJsonFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/pttypesexceptiondetailstojson_fuzzer.h b/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/pttypesexceptiondetailstojson_fuzzer.h new file mode 100644 index 00000000..dfa5affd --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/pttypesexceptiondetailstojson_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesexceptiondetailstojson_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/BUILD.gn new file mode 100644 index 00000000..f1dc9cf7 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesExceptionDetailsUrlFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/pttypesexceptiondetailsurl_fuzzer" + + sources = [ "pttypesexceptiondetailsurl_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesExceptionDetailsUrlFuzzTest" ] +} diff --git a/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/corpus/init b/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/project.xml b/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/pttypesexceptiondetailsurl_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/pttypesexceptiondetailsurl_fuzzer.cpp new file mode 100644 index 00000000..c78a8bd5 --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/pttypesexceptiondetailsurl_fuzzer.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesexceptiondetailsurl_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesExceptionDetailsUrlFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + ExceptionDetails details; + details.SetUrl(std::string((const char*)data, size)); + details.GetUrl(); + details.HasUrl(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesExceptionDetailsUrlFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/pttypesexceptiondetailsurl_fuzzer.h b/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/pttypesexceptiondetailsurl_fuzzer.h new file mode 100644 index 00000000..fa5d591c --- /dev/null +++ b/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/pttypesexceptiondetailsurl_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesexceptiondetailsurl_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesfunctionremoteobject_fuzzer/BUILD.gn b/test/fuzztest/pttypesfunctionremoteobject_fuzzer/BUILD.gn new file mode 100644 index 00000000..d11bb07e --- /dev/null +++ b/test/fuzztest/pttypesfunctionremoteobject_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesFunctionRemoteObjectFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/pttypesfunctionremoteobject_fuzzer" + + sources = [ "pttypesfunctionremoteobject_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesFunctionRemoteObjectFuzzTest" ] +} diff --git a/test/fuzztest/pttypesfunctionremoteobject_fuzzer/corpus/init b/test/fuzztest/pttypesfunctionremoteobject_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesfunctionremoteobject_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesfunctionremoteobject_fuzzer/project.xml b/test/fuzztest/pttypesfunctionremoteobject_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesfunctionremoteobject_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesfunctionremoteobject_fuzzer/pttypesfunctionremoteobject_fuzzer.cpp b/test/fuzztest/pttypesfunctionremoteobject_fuzzer/pttypesfunctionremoteobject_fuzzer.cpp new file mode 100644 index 00000000..287b9cbb --- /dev/null +++ b/test/fuzztest/pttypesfunctionremoteobject_fuzzer/pttypesfunctionremoteobject_fuzzer.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesfunctionremoteobject_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesFunctionRemoteObjectFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + Local exception = DebuggerApi::GetAndClearException(vm); + FunctionRemoteObject obj(vm, exception); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesFunctionRemoteObjectFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesfunctionremoteobject_fuzzer/pttypesfunctionremoteobject_fuzzer.h b/test/fuzztest/pttypesfunctionremoteobject_fuzzer/pttypesfunctionremoteobject_fuzzer.h new file mode 100644 index 00000000..cd673c90 --- /dev/null +++ b/test/fuzztest/pttypesfunctionremoteobject_fuzzer/pttypesfunctionremoteobject_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesfunctionremoteobject_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/BUILD.gn b/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/BUILD.gn new file mode 100644 index 00000000..73e7c643 --- /dev/null +++ b/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesGeneratorFunctionRemoteObjectFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer" + + sources = [ "pttypesgeneratorfunctionremoteobject_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesGeneratorFunctionRemoteObjectFuzzTest" ] +} diff --git a/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/corpus/init b/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/project.xml b/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/pttypesgeneratorfunctionremoteobject_fuzzer.cpp b/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/pttypesgeneratorfunctionremoteobject_fuzzer.cpp new file mode 100644 index 00000000..9b37098b --- /dev/null +++ b/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/pttypesgeneratorfunctionremoteobject_fuzzer.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesgeneratorfunctionremoteobject_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesGeneratorFunctionRemoteObjectFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + GeneratorFunctionRemoteObject obj(vm, JSValueRef::Undefined(vm)); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesGeneratorFunctionRemoteObjectFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/pttypesgeneratorfunctionremoteobject_fuzzer.h b/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/pttypesgeneratorfunctionremoteobject_fuzzer.h new file mode 100644 index 00000000..c28f5bc5 --- /dev/null +++ b/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/pttypesgeneratorfunctionremoteobject_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesgeneratorfunctionremoteobject_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesobjectremoteobject_fuzzer/BUILD.gn b/test/fuzztest/pttypesobjectremoteobject_fuzzer/BUILD.gn new file mode 100644 index 00000000..32671ced --- /dev/null +++ b/test/fuzztest/pttypesobjectremoteobject_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesObjectRemoteObjectFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/pttypesobjectremoteobject_fuzzer" + + sources = [ "pttypesobjectremoteobject_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesObjectRemoteObjectFuzzTest" ] +} diff --git a/test/fuzztest/pttypesobjectremoteobject_fuzzer/corpus/init b/test/fuzztest/pttypesobjectremoteobject_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesobjectremoteobject_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesobjectremoteobject_fuzzer/project.xml b/test/fuzztest/pttypesobjectremoteobject_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesobjectremoteobject_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesobjectremoteobject_fuzzer/pttypesobjectremoteobject_fuzzer.cpp b/test/fuzztest/pttypesobjectremoteobject_fuzzer/pttypesobjectremoteobject_fuzzer.cpp new file mode 100644 index 00000000..b713da6a --- /dev/null +++ b/test/fuzztest/pttypesobjectremoteobject_fuzzer/pttypesobjectremoteobject_fuzzer.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesobjectremoteobject_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesObjectRemoteObjectFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + ObjectRemoteObject obj(vm, StringRef::NewFromUtf8(vm, (const char*)data, size), + std::string((const char*)data, size)); + ObjectRemoteObject object(vm, StringRef::NewFromUtf8(vm, (const char*)data, size), + std::string((const char*)data, size), std::string((const char*)data, size)); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesObjectRemoteObjectFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesobjectremoteobject_fuzzer/pttypesobjectremoteobject_fuzzer.h b/test/fuzztest/pttypesobjectremoteobject_fuzzer/pttypesobjectremoteobject_fuzzer.h new file mode 100644 index 00000000..583ad305 --- /dev/null +++ b/test/fuzztest/pttypesobjectremoteobject_fuzzer/pttypesobjectremoteobject_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesobjectremoteobject_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/BUILD.gn b/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/BUILD.gn new file mode 100644 index 00000000..0ab5b598 --- /dev/null +++ b/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesPrimitiveRemoteObjectFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesprimitiveremoteobject_fuzzer" + + sources = [ "pttypesprimitiveremoteobject_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesPrimitiveRemoteObjectFuzzTest" ] +} diff --git a/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/corpus/init b/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/project.xml b/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/pttypesprimitiveremoteobject_fuzzer.cpp b/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/pttypesprimitiveremoteobject_fuzzer.cpp new file mode 100644 index 00000000..a3d2e19c --- /dev/null +++ b/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/pttypesprimitiveremoteobject_fuzzer.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesprimitiveremoteobject_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesPrimitiveRemoteObjectFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + PrimitiveRemoteObject obj(vm, StringRef::NewFromUtf8(vm, (const char*)data, size)); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesPrimitiveRemoteObjectFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/pttypesprimitiveremoteobject_fuzzer.h b/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/pttypesprimitiveremoteobject_fuzzer.h new file mode 100644 index 00000000..41042665 --- /dev/null +++ b/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/pttypesprimitiveremoteobject_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesprimitiveremoteobject_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobject_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobject_fuzzer/BUILD.gn new file mode 100644 index 00000000..352f843e --- /dev/null +++ b/test/fuzztest/pttypesremoteobject_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesRemoteObjectFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/pttypesremoteobject_fuzzer" + + sources = [ "pttypesremoteobject_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesRemoteObjectFuzzTest" ] +} diff --git a/test/fuzztest/pttypesremoteobject_fuzzer/corpus/init b/test/fuzztest/pttypesremoteobject_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesremoteobject_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesremoteobject_fuzzer/project.xml b/test/fuzztest/pttypesremoteobject_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesremoteobject_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobject_fuzzer/pttypesremoteobject_fuzzer.cpp b/test/fuzztest/pttypesremoteobject_fuzzer/pttypesremoteobject_fuzzer.cpp new file mode 100644 index 00000000..9662e823 --- /dev/null +++ b/test/fuzztest/pttypesremoteobject_fuzzer/pttypesremoteobject_fuzzer.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesremoteobject_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesRemoteObjectFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + RemoteObject obj; + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesRemoteObjectFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesremoteobject_fuzzer/pttypesremoteobject_fuzzer.h b/test/fuzztest/pttypesremoteobject_fuzzer/pttypesremoteobject_fuzzer.h new file mode 100644 index 00000000..8ef2e3f5 --- /dev/null +++ b/test/fuzztest/pttypesremoteobject_fuzzer/pttypesremoteobject_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesremoteobject_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectdescription_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectdescription_fuzzer/BUILD.gn new file mode 100644 index 00000000..2dd58c26 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectdescription_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesRemoteObjectDescriptionFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesremoteobjectdescription_fuzzer" + + sources = [ "pttypesremoteobjectdescription_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesRemoteObjectDescriptionFuzzTest" ] +} diff --git a/test/fuzztest/pttypesremoteobjectdescription_fuzzer/corpus/init b/test/fuzztest/pttypesremoteobjectdescription_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectdescription_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesremoteobjectdescription_fuzzer/project.xml b/test/fuzztest/pttypesremoteobjectdescription_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectdescription_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectdescription_fuzzer/pttypesremoteobjectdescription_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectdescription_fuzzer/pttypesremoteobjectdescription_fuzzer.cpp new file mode 100644 index 00000000..e9540031 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectdescription_fuzzer/pttypesremoteobjectdescription_fuzzer.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesremoteobjectdescription_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesRemoteObjectDescriptionFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + RemoteObject obj; + obj.SetDescription(std::string((const char*)data, size)); + std::string des = obj.GetDescription(); + obj.HasDescription(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesRemoteObjectDescriptionFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesremoteobjectdescription_fuzzer/pttypesremoteobjectdescription_fuzzer.h b/test/fuzztest/pttypesremoteobjectdescription_fuzzer/pttypesremoteobjectdescription_fuzzer.h new file mode 100644 index 00000000..65d77a2d --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectdescription_fuzzer/pttypesremoteobjectdescription_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesremoteobjectdescription_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/BUILD.gn new file mode 100644 index 00000000..fc4a574e --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesRemoteObjectGetClassNameFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer" + + sources = [ "pttypesremoteobjectgetclassname_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesRemoteObjectGetClassNameFuzzTest" ] +} diff --git a/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/corpus/init b/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/project.xml b/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/pttypesremoteobjectgetclassname_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/pttypesremoteobjectgetclassname_fuzzer.cpp new file mode 100644 index 00000000..79d5d464 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/pttypesremoteobjectgetclassname_fuzzer.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesremoteobjectgetclassname_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesRemoteObjectGetClassNameFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + RemoteObject obj; + obj.SetClassName(std::string((const char*)data, size)); + obj.GetClassName(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesRemoteObjectGetClassNameFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/pttypesremoteobjectgetclassname_fuzzer.h b/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/pttypesremoteobjectgetclassname_fuzzer.h new file mode 100644 index 00000000..24190980 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/pttypesremoteobjectgetclassname_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesremoteobjectgetclassname_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/BUILD.gn new file mode 100644 index 00000000..b9a48473 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesRemoteObjectGetSubTypeFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer" + + sources = [ "pttypesremoteobjectgetsubtype_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesRemoteObjectGetSubTypeFuzzTest" ] +} diff --git a/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/corpus/init b/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/project.xml b/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/pttypesremoteobjectgetsubtype_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/pttypesremoteobjectgetsubtype_fuzzer.cpp new file mode 100644 index 00000000..3ac620a7 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/pttypesremoteobjectgetsubtype_fuzzer.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesremoteobjectgetsubtype_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesRemoteObjectGetSubTypeFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + RemoteObject obj; + obj.SetSubType(std::string((const char*)data, size)); + std::string type = obj.GetSubType(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesRemoteObjectGetSubTypeFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/pttypesremoteobjectgetsubtype_fuzzer.h b/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/pttypesremoteobjectgetsubtype_fuzzer.h new file mode 100644 index 00000000..db409ed0 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/pttypesremoteobjectgetsubtype_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesremoteobjectgetsubtype_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectgettype_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectgettype_fuzzer/BUILD.gn new file mode 100644 index 00000000..1881707f --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgettype_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesRemoteObjectGetTypeFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/pttypesremoteobjectgettype_fuzzer" + + sources = [ "pttypesremoteobjectgettype_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesRemoteObjectGetTypeFuzzTest" ] +} diff --git a/test/fuzztest/pttypesremoteobjectgettype_fuzzer/corpus/init b/test/fuzztest/pttypesremoteobjectgettype_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgettype_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesremoteobjectgettype_fuzzer/project.xml b/test/fuzztest/pttypesremoteobjectgettype_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgettype_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectgettype_fuzzer/pttypesremoteobjectgettype_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectgettype_fuzzer/pttypesremoteobjectgettype_fuzzer.cpp new file mode 100644 index 00000000..c5f7d02d --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgettype_fuzzer/pttypesremoteobjectgettype_fuzzer.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesremoteobjectgettype_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesRemoteObjectGetTypeFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + RemoteObject obj; + std::string type = obj.GetType(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesRemoteObjectGetTypeFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesremoteobjectgettype_fuzzer/pttypesremoteobjectgettype_fuzzer.h b/test/fuzztest/pttypesremoteobjectgettype_fuzzer/pttypesremoteobjectgettype_fuzzer.h new file mode 100644 index 00000000..331bf907 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgettype_fuzzer/pttypesremoteobjectgettype_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesremoteobjectgettype_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/BUILD.gn new file mode 100644 index 00000000..0ac97883 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesRemoteObjectGetValueFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer" + + sources = [ "pttypesremoteobjectgetvalue_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesRemoteObjectGetValueFuzzTest" ] +} diff --git a/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/corpus/init b/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/project.xml b/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/pttypesremoteobjectgetvalue_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/pttypesremoteobjectgetvalue_fuzzer.cpp new file mode 100644 index 00000000..761a78d2 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/pttypesremoteobjectgetvalue_fuzzer.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesremoteobjectgetvalue_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesRemoteObjectGetValueFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + RemoteObject obj; + Local val = JSValueRef::Undefined(vm); + obj.SetValue(val); + Local ref = obj.GetValue(); + ref.IsEmpty(); + obj.HasValue(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesRemoteObjectGetValueFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/pttypesremoteobjectgetvalue_fuzzer.h b/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/pttypesremoteobjectgetvalue_fuzzer.h new file mode 100644 index 00000000..1ab4d41a --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/pttypesremoteobjectgetvalue_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesremoteobjectgetvalue_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/BUILD.gn new file mode 100644 index 00000000..48f88756 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesRemoteObjectHasClassNameFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer" + + sources = [ "pttypesremoteobjecthasclassname_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesRemoteObjectHasClassNameFuzzTest" ] +} diff --git a/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/corpus/init b/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/project.xml b/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/pttypesremoteobjecthasclassname_fuzzer.cpp b/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/pttypesremoteobjecthasclassname_fuzzer.cpp new file mode 100644 index 00000000..f560041e --- /dev/null +++ b/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/pttypesremoteobjecthasclassname_fuzzer.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesremoteobjecthasclassname_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesRemoteObjectHasClassNameFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + RemoteObject obj; + obj.HasClassName(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesRemoteObjectHasClassNameFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/pttypesremoteobjecthasclassname_fuzzer.h b/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/pttypesremoteobjecthasclassname_fuzzer.h new file mode 100644 index 00000000..670a30ab --- /dev/null +++ b/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/pttypesremoteobjecthasclassname_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesremoteobjecthasclassname_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/BUILD.gn new file mode 100644 index 00000000..df06c5aa --- /dev/null +++ b/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesRemoteObjectHasSubTypeFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer" + + sources = [ "pttypesremoteobjecthassubtype_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesRemoteObjectHasSubTypeFuzzTest" ] +} diff --git a/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/corpus/init b/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/project.xml b/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/pttypesremoteobjecthassubtype_fuzzer.cpp b/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/pttypesremoteobjecthassubtype_fuzzer.cpp new file mode 100644 index 00000000..d34ce6e5 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/pttypesremoteobjecthassubtype_fuzzer.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesremoteobjecthassubtype_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesRemoteObjectHasSubTypeFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + RemoteObject obj; + obj.HasSubType(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesRemoteObjectHasSubTypeFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/pttypesremoteobjecthassubtype_fuzzer.h b/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/pttypesremoteobjecthassubtype_fuzzer.h new file mode 100644 index 00000000..5b2b8cec --- /dev/null +++ b/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/pttypesremoteobjecthassubtype_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesremoteobjecthassubtype_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/BUILD.gn new file mode 100644 index 00000000..1ace860a --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesRemoteObjectObjectIdFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/pttypesremoteobjectobjectid_fuzzer" + + sources = [ "pttypesremoteobjectobjectid_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesRemoteObjectObjectIdFuzzTest" ] +} diff --git a/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/corpus/init b/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/project.xml b/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/pttypesremoteobjectobjectid_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/pttypesremoteobjectobjectid_fuzzer.cpp new file mode 100644 index 00000000..acc9b5df --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/pttypesremoteobjectobjectid_fuzzer.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesremoteobjectobjectid_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesRemoteObjectObjectIdFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + RemoteObject obj; + RemoteObjectId id = (RemoteObjectId)*data; + obj.SetObjectId(id); + id = obj.GetObjectId(); + obj.HasObjectId(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesRemoteObjectObjectIdFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/pttypesremoteobjectobjectid_fuzzer.h b/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/pttypesremoteobjectobjectid_fuzzer.h new file mode 100644 index 00000000..963bc056 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/pttypesremoteobjectobjectid_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesremoteobjectobjectid_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/BUILD.gn new file mode 100644 index 00000000..da25a1d4 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesRemoteObjectSetClassNameFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer" + + sources = [ "pttypesremoteobjectsetclassname_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesRemoteObjectSetClassNameFuzzTest" ] +} diff --git a/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/corpus/init b/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/project.xml b/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/pttypesremoteobjectsetclassname_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/pttypesremoteobjectsetclassname_fuzzer.cpp new file mode 100644 index 00000000..04321ac6 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/pttypesremoteobjectsetclassname_fuzzer.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesremoteobjectsetclassname_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesRemoteObjectSetClassNameFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + RemoteObject obj; + obj.SetClassName(std::string((const char*)data, size)); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesRemoteObjectSetClassNameFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/pttypesremoteobjectsetclassname_fuzzer.h b/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/pttypesremoteobjectsetclassname_fuzzer.h new file mode 100644 index 00000000..0b17091e --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/pttypesremoteobjectsetclassname_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesremoteobjectsetclassname_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/BUILD.gn new file mode 100644 index 00000000..c8c56abe --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesRemoteObjectSetSubTypeFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer" + + sources = [ "pttypesremoteobjectsetsubtype_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesRemoteObjectSetSubTypeFuzzTest" ] +} diff --git a/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/corpus/init b/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/project.xml b/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/pttypesremoteobjectsetsubtype_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/pttypesremoteobjectsetsubtype_fuzzer.cpp new file mode 100644 index 00000000..10303309 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/pttypesremoteobjectsetsubtype_fuzzer.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesremoteobjectsetsubtype_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesRemoteObjectSetSubTypeFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + RemoteObject obj; + obj.SetSubType(std::string((const char*)data, size)); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesRemoteObjectSetSubTypeFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/pttypesremoteobjectsetsubtype_fuzzer.h b/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/pttypesremoteobjectsetsubtype_fuzzer.h new file mode 100644 index 00000000..ba7cfcb1 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/pttypesremoteobjectsetsubtype_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesremoteobjectsetsubtype_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectsettype_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectsettype_fuzzer/BUILD.gn new file mode 100644 index 00000000..d8f46587 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsettype_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesRemoteObjectSetTypeFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/pttypesremoteobjectsettype_fuzzer" + + sources = [ "pttypesremoteobjectsettype_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesRemoteObjectSetTypeFuzzTest" ] +} diff --git a/test/fuzztest/pttypesremoteobjectsettype_fuzzer/corpus/init b/test/fuzztest/pttypesremoteobjectsettype_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsettype_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesremoteobjectsettype_fuzzer/project.xml b/test/fuzztest/pttypesremoteobjectsettype_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsettype_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectsettype_fuzzer/pttypesremoteobjectsettype_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectsettype_fuzzer/pttypesremoteobjectsettype_fuzzer.cpp new file mode 100644 index 00000000..bf0fcbdb --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsettype_fuzzer/pttypesremoteobjectsettype_fuzzer.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesremoteobjectsettype_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesRemoteObjectSetTypeFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + RemoteObject obj; + obj.SetType(std::string((const char*)data, size)); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesRemoteObjectSetTypeFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesremoteobjectsettype_fuzzer/pttypesremoteobjectsettype_fuzzer.h b/test/fuzztest/pttypesremoteobjectsettype_fuzzer/pttypesremoteobjectsettype_fuzzer.h new file mode 100644 index 00000000..ef476766 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsettype_fuzzer/pttypesremoteobjectsettype_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesremoteobjectsettype_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/BUILD.gn new file mode 100644 index 00000000..c6692999 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesRemoteObjectSetValueFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer" + + sources = [ "pttypesremoteobjectsetvalue_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesRemoteObjectSetValueFuzzTest" ] +} diff --git a/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/corpus/init b/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/project.xml b/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/pttypesremoteobjectsetvalue_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/pttypesremoteobjectsetvalue_fuzzer.cpp new file mode 100644 index 00000000..95f67506 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/pttypesremoteobjectsetvalue_fuzzer.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesremoteobjectsetvalue_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesRemoteObjectSetValueFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + RemoteObject obj; + Local val = JSValueRef::Undefined(vm); + obj.SetValue(val); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesRemoteObjectSetValueFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/pttypesremoteobjectsetvalue_fuzzer.h b/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/pttypesremoteobjectsetvalue_fuzzer.h new file mode 100644 index 00000000..297025be --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/pttypesremoteobjectsetvalue_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesremoteobjectsetvalue_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/BUILD.gn new file mode 100644 index 00000000..d504b36a --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesRemoteObjectUnserializableValueFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer" + + sources = [ "pttypesremoteobjectunserializablevalue_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesRemoteObjectUnserializableValueFuzzTest" ] +} diff --git a/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/corpus/init b/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/project.xml b/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/pttypesremoteobjectunserializablevalue_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/pttypesremoteobjectunserializablevalue_fuzzer.cpp new file mode 100644 index 00000000..bdb58e7b --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/pttypesremoteobjectunserializablevalue_fuzzer.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesremoteobjectunserializablevalue_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesRemoteObjectUnserializableValueFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + RemoteObject obj; + UnserializableValue val((const char*)data, size); + obj.SetUnserializableValue(val); + obj.GetUnserializableValue(); + obj.HasUnserializableValue(); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesRemoteObjectUnserializableValueFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/pttypesremoteobjectunserializablevalue_fuzzer.h b/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/pttypesremoteobjectunserializablevalue_fuzzer.h new file mode 100644 index 00000000..5492fb17 --- /dev/null +++ b/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/pttypesremoteobjectunserializablevalue_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesremoteobjectunserializablevalue_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesstringremoteobject_fuzzer/BUILD.gn b/test/fuzztest/pttypesstringremoteobject_fuzzer/BUILD.gn new file mode 100644 index 00000000..c52ea08b --- /dev/null +++ b/test/fuzztest/pttypesstringremoteobject_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesStringRemoteObjectFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/pttypesstringremoteobject_fuzzer" + + sources = [ "pttypesstringremoteobject_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesStringRemoteObjectFuzzTest" ] +} diff --git a/test/fuzztest/pttypesstringremoteobject_fuzzer/corpus/init b/test/fuzztest/pttypesstringremoteobject_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypesstringremoteobject_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypesstringremoteobject_fuzzer/project.xml b/test/fuzztest/pttypesstringremoteobject_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypesstringremoteobject_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypesstringremoteobject_fuzzer/pttypesstringremoteobject_fuzzer.cpp b/test/fuzztest/pttypesstringremoteobject_fuzzer/pttypesstringremoteobject_fuzzer.cpp new file mode 100644 index 00000000..e2243648 --- /dev/null +++ b/test/fuzztest/pttypesstringremoteobject_fuzzer/pttypesstringremoteobject_fuzzer.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypesstringremoteobject_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesStringRemoteObjectFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + StringRemoteObject obj(vm, StringRef::NewFromUtf8(vm, (const char*)data, size)); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesStringRemoteObjectFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypesstringremoteobject_fuzzer/pttypesstringremoteobject_fuzzer.h b/test/fuzztest/pttypesstringremoteobject_fuzzer/pttypesstringremoteobject_fuzzer.h new file mode 100644 index 00000000..e0f2e310 --- /dev/null +++ b/test/fuzztest/pttypesstringremoteobject_fuzzer/pttypesstringremoteobject_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypesstringremoteobject_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/pttypessymbolremoteobject_fuzzer/BUILD.gn b/test/fuzztest/pttypessymbolremoteobject_fuzzer/BUILD.gn new file mode 100644 index 00000000..560a24d5 --- /dev/null +++ b/test/fuzztest/pttypessymbolremoteobject_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +##################################hydra-fuzz################################### +import("//arkcompiler/toolchain/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") +import("//build/test.gni") + +##################################fuzztest##################################### +ohos_fuzztest("PtTypesSymbolRemoteObjectFuzzTest") { + module_out_path = "arkcompiler/toolchain" + + fuzz_config_file = + "//arkcompiler/toolchain/test/fuzztest/pttypessymbolremoteobject_fuzzer" + + sources = [ "pttypessymbolremoteobject_fuzzer.cpp" ] + + configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] + + deps = [ + "//arkcompiler/ets_runtime:libark_jsruntime", + "//arkcompiler/toolchain/tooling:libark_ecma_debugger_set", + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + sdk_libc_secshared_dep, + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":PtTypesSymbolRemoteObjectFuzzTest" ] +} diff --git a/test/fuzztest/pttypessymbolremoteobject_fuzzer/corpus/init b/test/fuzztest/pttypessymbolremoteobject_fuzzer/corpus/init new file mode 100644 index 00000000..b9a20c8e --- /dev/null +++ b/test/fuzztest/pttypessymbolremoteobject_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2021 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/test/fuzztest/pttypessymbolremoteobject_fuzzer/project.xml b/test/fuzztest/pttypessymbolremoteobject_fuzzer/project.xml new file mode 100644 index 00000000..f7de9064 --- /dev/null +++ b/test/fuzztest/pttypessymbolremoteobject_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/fuzztest/pttypessymbolremoteobject_fuzzer/pttypessymbolremoteobject_fuzzer.cpp b/test/fuzztest/pttypessymbolremoteobject_fuzzer/pttypessymbolremoteobject_fuzzer.cpp new file mode 100644 index 00000000..d64368c0 --- /dev/null +++ b/test/fuzztest/pttypessymbolremoteobject_fuzzer/pttypessymbolremoteobject_fuzzer.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pttypessymbolremoteobject_fuzzer.h" +#include "ecmascript/napi/include/jsnapi.h" +#include "tooling/base/pt_types.h" + +using namespace panda; +using namespace panda::ecmascript; +using namespace panda::ecmascript::tooling; + +namespace OHOS { + void PtTypesSymbolRemoteObjectFuzzTest(const uint8_t* data, size_t size) + { + RuntimeOption option; + option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + auto vm = JSNApi::CreateJSVM(option); + if (size <= 0 || data == NULL) { + return; + } + SymbolRemoteObject obj(vm, SymbolRef::New(vm, StringRef::NewFromUtf8(vm, (const char*)data, size))); + JSNApi::DestroyJSVM(vm); + } +} + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + OHOS::PtTypesSymbolRemoteObjectFuzzTest(data, size); + return 0; +} diff --git a/test/fuzztest/pttypessymbolremoteobject_fuzzer/pttypessymbolremoteobject_fuzzer.h b/test/fuzztest/pttypessymbolremoteobject_fuzzer/pttypessymbolremoteobject_fuzzer.h new file mode 100644 index 00000000..f8a4373c --- /dev/null +++ b/test/fuzztest/pttypessymbolremoteobject_fuzzer/pttypessymbolremoteobject_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PROTOCOLHANDLER_FUZZER_H +#define PROTOCOLHANDLER_FUZZER_H + +#define FUZZ_PROJECT_NAME "pttypessymbolremoteobject_fuzzer" + +#endif \ No newline at end of file -- Gitee