diff --git a/test/fuzztest/BUILD.gn b/test/fuzztest/BUILD.gn index e79944a8662c632ec9e7ca31ae89d4bcc4da13c8..a058013e44f1f1d01048a71cbec4717b2a58e1a6 100644 --- a/test/fuzztest/BUILD.gn +++ b/test/fuzztest/BUILD.gn @@ -34,7 +34,6 @@ group("fuzztest") { "protocolhandlersendreply_fuzzer:fuzztest", "pttypesbreakpointparseid_fuzzer:fuzztest", "pttypesbreakpointtostring_fuzzer:fuzztest", - "pttypesexceptiondetails_fuzzer:fuzztest", "pttypesexceptiondetailscolumn_fuzzer:fuzztest", "pttypesexceptiondetailscreate_fuzzer:fuzztest", "pttypesexceptiondetailsexception_fuzzer:fuzztest", @@ -43,23 +42,17 @@ group("fuzztest") { "pttypesexceptiondetailsline_fuzzer:fuzztest", "pttypesexceptiondetailsscriptid_fuzzer:fuzztest", "pttypesexceptiondetailstext_fuzzer:fuzztest", - "pttypesexceptiondetailstojson_fuzzer:fuzztest", "pttypesexceptiondetailsurl_fuzzer:fuzztest", - "pttypesinternalpropertydesp_fuzzer:fuzztest", "pttypesinternalpropertydespcreate_fuzzer:fuzztest", "pttypesinternalpropertydespname_fuzzer:fuzztest", - "pttypesinternalpropertydesptojson_fuzzer:fuzztest", "pttypesinternalpropertydespvalue_fuzzer:fuzztest", "pttypesobjectremoteobject_fuzzer:fuzztest", "pttypesprimitiveremoteobject_fuzzer:fuzztest", - "pttypesprivatepropertydesp_fuzzer:fuzztest", "pttypesprivatepropertydespcreate_fuzzer:fuzztest", "pttypesprivatepropertydespget_fuzzer:fuzztest", "pttypesprivatepropertydespname_fuzzer:fuzztest", "pttypesprivatepropertydespset_fuzzer:fuzztest", - "pttypesprivatepropertydesptojson_fuzzer:fuzztest", "pttypesprivatepropertydespvalue_fuzzer:fuzztest", - "pttypesremoteobject_fuzzer:fuzztest", "pttypesremoteobjectdescription_fuzzer:fuzztest", "pttypesremoteobjectgetclassname_fuzzer:fuzztest", "pttypesremoteobjectgetsubtype_fuzzer:fuzztest", @@ -71,7 +64,6 @@ group("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/pttypesexceptiondetails_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetails_fuzzer/BUILD.gn deleted file mode 100644 index 5447437426846b6c1c78ea0b128035ecac52081c..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesexceptiondetails_fuzzer/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# 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 = toolchain_output_path - - fuzz_config_file = - "//arkcompiler/toolchain/test/fuzztest/pttypesexceptiondetails_fuzzer" - - sources = [ "pttypesexceptiondetails_fuzzer.cpp" ] - - configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - - deps = [ "../../../tooling:libark_ecma_debugger_set" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ - "cJSON:cjson", - "ets_runtime:libark_jsruntime", - "icu:shared_icuuc", - "libuv:uv", - sdk_libc_secshared_dep, - ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":PtTypesExceptionDetailsFuzzTest" ] -} diff --git a/test/fuzztest/pttypesexceptiondetails_fuzzer/corpus/init b/test/fuzztest/pttypesexceptiondetails_fuzzer/corpus/init deleted file mode 100644 index b9a20c8eb6a74b442cec3b244a433adbfa9414a2..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesexceptiondetails_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# 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 deleted file mode 100644 index f7de9064465d473bb8e10fc88f0764eaad2d6112..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesexceptiondetails_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 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 deleted file mode 100644 index e6c510550197715085ce0e54d77e684aa2934ad0..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesexceptiondetails_fuzzer/pttypesexceptiondetails_fuzzer.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 deleted file mode 100644 index 7b031a6b08018f07f51eff263ffe0d67d952e1db..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesexceptiondetails_fuzzer/pttypesexceptiondetails_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.cpp index 1732fa117d1440d3ed00a23b540ceae723950fd6..b8ffae12d4f1f8aa5fb2abe1da2dd435aab361c7 100644 --- a/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.cpp +++ b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.cpp @@ -33,12 +33,8 @@ namespace OHOS { // if data: "{\"\":1," // cJSON_ParseWithLength will heap-buffer-overflow // https://github.com/DaveGamble/cJSON/issues/804 - cJSON* cjson = NULL; - if (cjson != NULL) { - PtJson pjson(cjson); - auto details = ExceptionDetails::Create(pjson); - cJSON_Delete(cjson); - } + std::unique_ptr pjson = PtJson::Parse(std::string((const char*)data, size)); + auto details = ExceptionDetails::Create(*pjson); JSNApi::DestroyJSVM(vm); } diff --git a/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/pttypesexceptiondetailsexception_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/pttypesexceptiondetailsexception_fuzzer.cpp index dd3ffb2496ae8492491148e712e98661e6c29e9a..2e65d82a27eb1c761db1d71652d5abca75f47f7f 100644 --- a/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/pttypesexceptiondetailsexception_fuzzer.cpp +++ b/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/pttypesexceptiondetailsexception_fuzzer.cpp @@ -31,8 +31,10 @@ namespace OHOS { return; } ExceptionDetails details; - std::unique_ptr obj = std::make_unique(); - details.SetException(std::move(obj)); + uint8_t* val = const_cast(data); + RemoteObject* val1 = reinterpret_cast(val); + std::unique_ptr remote(val1); + details.SetException(std::move(remote)); details.GetException(); details.HasException(); JSNApi::DestroyJSVM(vm); diff --git a/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/BUILD.gn deleted file mode 100644 index ad1e8f3cc8e4c1ae8a24aa39c371603d5471c8b7..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/BUILD.gn +++ /dev/null @@ -1,48 +0,0 @@ -# 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 = toolchain_output_path - - fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesexceptiondetailstojson_fuzzer" - - sources = [ "pttypesexceptiondetailstojson_fuzzer.cpp" ] - - configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - - deps = [ "../../../tooling:libark_ecma_debugger_set" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ - "cJSON:cjson", - "ets_runtime:libark_jsruntime", - "icu:shared_icuuc", - "libuv:uv", - sdk_libc_secshared_dep, - ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":PtTypesExceptionDetailsToJsonFuzzTest" ] -} diff --git a/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/corpus/init b/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/corpus/init deleted file mode 100644 index b9a20c8eb6a74b442cec3b244a433adbfa9414a2..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# 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 deleted file mode 100644 index f7de9064465d473bb8e10fc88f0764eaad2d6112..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 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 deleted file mode 100644 index 315db3fce29a89958f3c3dce65b794990cfe3583..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/pttypesexceptiondetailstojson_fuzzer.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 deleted file mode 100644 index dfa5affd3b1bad10a76a9b85b8cc085bd2162727..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/pttypesexceptiondetailstojson_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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/pttypesinternalpropertydesp_fuzzer/BUILD.gn b/test/fuzztest/pttypesinternalpropertydesp_fuzzer/BUILD.gn deleted file mode 100755 index 89046fab124a3f1f19e631f788d9250ec5ed4f17..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesinternalpropertydesp_fuzzer/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# 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("PtTypesInternalPropertyDespFuzzTest") { - module_out_path = toolchain_output_path - - fuzz_config_file = - "//arkcompiler/toolchain/test/fuzztest/pttypesinternalpropertydesp_fuzzer" - - sources = [ "pttypesinternalpropertydesp_fuzzer.cpp" ] - - configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - - deps = [ "../../../tooling:libark_ecma_debugger_set" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ - "cJSON:cjson", - "ets_runtime:libark_jsruntime", - "icu:shared_icuuc", - "libuv:uv", - sdk_libc_secshared_dep, - ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":PtTypesInternalPropertyDespFuzzTest" ] -} diff --git a/test/fuzztest/pttypesinternalpropertydesp_fuzzer/corpus/init b/test/fuzztest/pttypesinternalpropertydesp_fuzzer/corpus/init deleted file mode 100755 index b9a20c8eb6a74b442cec3b244a433adbfa9414a2..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesinternalpropertydesp_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# 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/pttypesinternalpropertydesp_fuzzer/project.xml b/test/fuzztest/pttypesinternalpropertydesp_fuzzer/project.xml deleted file mode 100755 index f7de9064465d473bb8e10fc88f0764eaad2d6112..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesinternalpropertydesp_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - \ No newline at end of file diff --git a/test/fuzztest/pttypesinternalpropertydesp_fuzzer/pttypesinternalpropertydesp_fuzzer.cpp b/test/fuzztest/pttypesinternalpropertydesp_fuzzer/pttypesinternalpropertydesp_fuzzer.cpp deleted file mode 100755 index 1754296169b89e92bf35bb741d921d8e2c6f4219..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesinternalpropertydesp_fuzzer/pttypesinternalpropertydesp_fuzzer.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 "pttypesinternalpropertydesp_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 PtTypesInternalPropertyDespFuzzTest(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; - } - InternalPropertyDescriptor desp; - JSNApi::DestroyJSVM(vm); - } -} - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - OHOS::PtTypesInternalPropertyDespFuzzTest(data, size); - return 0; -} diff --git a/test/fuzztest/pttypesinternalpropertydesp_fuzzer/pttypesinternalpropertydesp_fuzzer.h b/test/fuzztest/pttypesinternalpropertydesp_fuzzer/pttypesinternalpropertydesp_fuzzer.h deleted file mode 100755 index 6e8d2d9a8789fd1fb7a979f75b62c3c5f5ed799b..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesinternalpropertydesp_fuzzer/pttypesinternalpropertydesp_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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 "pttypesinternalpropertydesp_fuzzer" - -#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/BUILD.gn b/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/BUILD.gn deleted file mode 100755 index f3ebb61c2719bd0f567e5db349721dc30c916b66..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/BUILD.gn +++ /dev/null @@ -1,48 +0,0 @@ -# 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("PtTypesInternalPropertyDespToJsonFuzzTest") { - module_out_path = toolchain_output_path - - fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer" - - sources = [ "pttypesinternalpropertydesptojson_fuzzer.cpp" ] - - configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - - deps = [ "../../../tooling:libark_ecma_debugger_set" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ - "cJSON:cjson", - "ets_runtime:libark_jsruntime", - "icu:shared_icuuc", - "libuv:uv", - sdk_libc_secshared_dep, - ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":PtTypesInternalPropertyDespToJsonFuzzTest" ] -} diff --git a/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/corpus/init b/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/corpus/init deleted file mode 100755 index b9a20c8eb6a74b442cec3b244a433adbfa9414a2..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# 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/pttypesinternalpropertydesptojson_fuzzer/project.xml b/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/project.xml deleted file mode 100755 index f7de9064465d473bb8e10fc88f0764eaad2d6112..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - \ No newline at end of file diff --git a/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/pttypesinternalpropertydesptojson_fuzzer.cpp b/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/pttypesinternalpropertydesptojson_fuzzer.cpp deleted file mode 100755 index 865999217b640fbda26c2895b2b4dc48ab97ae5a..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/pttypesinternalpropertydesptojson_fuzzer.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 "pttypesinternalpropertydesptojson_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 PtTypesInternalPropertyDespToJsonFuzzTest(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; - } - InternalPropertyDescriptor desp; - desp.ToJson(); - JSNApi::DestroyJSVM(vm); - } -} - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - OHOS::PtTypesInternalPropertyDespToJsonFuzzTest(data, size); - return 0; -} diff --git a/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/pttypesinternalpropertydesptojson_fuzzer.h b/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/pttypesinternalpropertydesptojson_fuzzer.h deleted file mode 100755 index 283c94914dff757b4ad3538d091f530807e90cad..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/pttypesinternalpropertydesptojson_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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 "pttypesinternalpropertydesptojson_fuzzer" - -#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesinternalpropertydespvalue_fuzzer/pttypesinternalpropertydespvalue_fuzzer.cpp b/test/fuzztest/pttypesinternalpropertydespvalue_fuzzer/pttypesinternalpropertydespvalue_fuzzer.cpp index 5e5d04d4e9b8514943bb2b0eeced97ab24bd02e5..d7dcf1206cc2654ecf32c7ab84cdeaedb5872764 100755 --- a/test/fuzztest/pttypesinternalpropertydespvalue_fuzzer/pttypesinternalpropertydespvalue_fuzzer.cpp +++ b/test/fuzztest/pttypesinternalpropertydespvalue_fuzzer/pttypesinternalpropertydespvalue_fuzzer.cpp @@ -31,7 +31,9 @@ namespace OHOS { return; } InternalPropertyDescriptor desp; - auto remote = std::make_unique(); + uint8_t* val = const_cast(data); + RemoteObject* val1 = reinterpret_cast(val); + std::unique_ptr remote(val1); desp.SetValue(std::move(remote)); desp.GetValue(); desp.HasValue(); diff --git a/test/fuzztest/pttypesprivatepropertydesp_fuzzer/BUILD.gn b/test/fuzztest/pttypesprivatepropertydesp_fuzzer/BUILD.gn deleted file mode 100755 index 7da5dac854f16529c284ea4df64db37df747f368..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesprivatepropertydesp_fuzzer/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# 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("PtTypesPrivatePropertyDespFuzzTest") { - module_out_path = toolchain_output_path - - fuzz_config_file = - "//arkcompiler/toolchain/test/fuzztest/pttypesprivatepropertydesp_fuzzer" - - sources = [ "pttypesprivatepropertydesp_fuzzer.cpp" ] - - configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - - deps = [ "../../../tooling:libark_ecma_debugger_set" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ - "cJSON:cjson", - "ets_runtime:libark_jsruntime", - "icu:shared_icuuc", - "libuv:uv", - sdk_libc_secshared_dep, - ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":PtTypesPrivatePropertyDespFuzzTest" ] -} diff --git a/test/fuzztest/pttypesprivatepropertydesp_fuzzer/corpus/init b/test/fuzztest/pttypesprivatepropertydesp_fuzzer/corpus/init deleted file mode 100755 index b9a20c8eb6a74b442cec3b244a433adbfa9414a2..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesprivatepropertydesp_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# 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/pttypesprivatepropertydesp_fuzzer/project.xml b/test/fuzztest/pttypesprivatepropertydesp_fuzzer/project.xml deleted file mode 100755 index f7de9064465d473bb8e10fc88f0764eaad2d6112..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesprivatepropertydesp_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - \ No newline at end of file diff --git a/test/fuzztest/pttypesprivatepropertydesp_fuzzer/pttypesprivatepropertydesp_fuzzer.cpp b/test/fuzztest/pttypesprivatepropertydesp_fuzzer/pttypesprivatepropertydesp_fuzzer.cpp deleted file mode 100755 index c8e1f6602abf1bbc8f06ccbe6c51e9d502ccb281..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesprivatepropertydesp_fuzzer/pttypesprivatepropertydesp_fuzzer.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 "pttypesprivatepropertydesp_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 PtTypesPrivatePropertyDespFuzzTest(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; - } - PrivatePropertyDescriptor desp; - JSNApi::DestroyJSVM(vm); - } -} - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - OHOS::PtTypesPrivatePropertyDespFuzzTest(data, size); - return 0; -} diff --git a/test/fuzztest/pttypesprivatepropertydesp_fuzzer/pttypesprivatepropertydesp_fuzzer.h b/test/fuzztest/pttypesprivatepropertydesp_fuzzer/pttypesprivatepropertydesp_fuzzer.h deleted file mode 100755 index 29273d91ae9c1a18588db2e74014fe628c1f5535..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesprivatepropertydesp_fuzzer/pttypesprivatepropertydesp_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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 "pttypesprivatepropertydesp_fuzzer" - -#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesprivatepropertydespget_fuzzer/pttypesprivatepropertydespget_fuzzer.cpp b/test/fuzztest/pttypesprivatepropertydespget_fuzzer/pttypesprivatepropertydespget_fuzzer.cpp index 278189eea412115d28201221a882105643a0d7d4..543b8b9e64328736d5e9ac0a8db84bedd962a498 100755 --- a/test/fuzztest/pttypesprivatepropertydespget_fuzzer/pttypesprivatepropertydespget_fuzzer.cpp +++ b/test/fuzztest/pttypesprivatepropertydespget_fuzzer/pttypesprivatepropertydespget_fuzzer.cpp @@ -31,7 +31,9 @@ namespace OHOS { return; } PrivatePropertyDescriptor desp; - auto remote = std::make_unique(); + uint8_t* val = const_cast(data); + RemoteObject* val1 = reinterpret_cast(val); + std::unique_ptr remote(val1); desp.SetGet(std::move(remote)); desp.GetGet(); desp.HasGet(); diff --git a/test/fuzztest/pttypesprivatepropertydespset_fuzzer/pttypesprivatepropertydespset_fuzzer.cpp b/test/fuzztest/pttypesprivatepropertydespset_fuzzer/pttypesprivatepropertydespset_fuzzer.cpp index 4ad99271f36421e8ba28729ed181b7bd03806fe5..5f8141c453b65773ff5d9d881f467f88b154119b 100755 --- a/test/fuzztest/pttypesprivatepropertydespset_fuzzer/pttypesprivatepropertydespset_fuzzer.cpp +++ b/test/fuzztest/pttypesprivatepropertydespset_fuzzer/pttypesprivatepropertydespset_fuzzer.cpp @@ -31,7 +31,9 @@ namespace OHOS { return; } PrivatePropertyDescriptor desp; - auto remote = std::make_unique(); + uint8_t* val = const_cast(data); + RemoteObject* val1 = reinterpret_cast(val); + std::unique_ptr remote(val1); desp.SetSet(std::move(remote)); desp.GetSet(); desp.HasSet(); diff --git a/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/BUILD.gn b/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/BUILD.gn deleted file mode 100755 index f8021301b1f70a15813f84c7baab1ffa34df2d2c..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/BUILD.gn +++ /dev/null @@ -1,48 +0,0 @@ -# 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("PtTypesPrivatePropertyDespToJsonFuzzTest") { - module_out_path = toolchain_output_path - - fuzz_config_file = "//arkcompiler/toolchain/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer" - - sources = [ "pttypesprivatepropertydesptojson_fuzzer.cpp" ] - - configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - - deps = [ "../../../tooling:libark_ecma_debugger_set" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ - "cJSON:cjson", - "ets_runtime:libark_jsruntime", - "icu:shared_icuuc", - "libuv:uv", - sdk_libc_secshared_dep, - ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":PtTypesPrivatePropertyDespToJsonFuzzTest" ] -} diff --git a/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/corpus/init b/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/corpus/init deleted file mode 100755 index b9a20c8eb6a74b442cec3b244a433adbfa9414a2..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# 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/pttypesprivatepropertydesptojson_fuzzer/project.xml b/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/project.xml deleted file mode 100755 index f7de9064465d473bb8e10fc88f0764eaad2d6112..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - \ No newline at end of file diff --git a/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/pttypesprivatepropertydesptojson_fuzzer.cpp b/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/pttypesprivatepropertydesptojson_fuzzer.cpp deleted file mode 100755 index 12e81ae5b64f9c410b35368200cbc4473573386d..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/pttypesprivatepropertydesptojson_fuzzer.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 "pttypesprivatepropertydesptojson_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 PtTypesPrivatePropertyDespToJsonFuzzTest(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; - } - PrivatePropertyDescriptor desp; - desp.ToJson(); - JSNApi::DestroyJSVM(vm); - } -} - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - OHOS::PtTypesPrivatePropertyDespToJsonFuzzTest(data, size); - return 0; -} diff --git a/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/pttypesprivatepropertydesptojson_fuzzer.h b/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/pttypesprivatepropertydesptojson_fuzzer.h deleted file mode 100755 index ebcebd493fbf0ea6967016645eca39479f72df82..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/pttypesprivatepropertydesptojson_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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 "pttypesprivatepropertydespcreate_fuzzer" - -#endif \ No newline at end of file diff --git a/test/fuzztest/pttypesprivatepropertydespvalue_fuzzer/pttypesprivatepropertydespvalue_fuzzer.cpp b/test/fuzztest/pttypesprivatepropertydespvalue_fuzzer/pttypesprivatepropertydespvalue_fuzzer.cpp index 3d66d0821a2bd773a4df224b510aba952de0a3fc..d4f5b01a1d6f3b551ea561453a7c9cb8264d2560 100755 --- a/test/fuzztest/pttypesprivatepropertydespvalue_fuzzer/pttypesprivatepropertydespvalue_fuzzer.cpp +++ b/test/fuzztest/pttypesprivatepropertydespvalue_fuzzer/pttypesprivatepropertydespvalue_fuzzer.cpp @@ -31,7 +31,9 @@ namespace OHOS { return; } PrivatePropertyDescriptor desp; - auto remote = std::make_unique(); + uint8_t* val = const_cast(data); + RemoteObject* val1 = reinterpret_cast(val); + std::unique_ptr remote(val1); desp.SetValue(std::move(remote)); desp.GetValue(); desp.HasValue(); diff --git a/test/fuzztest/pttypesremoteobject_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobject_fuzzer/BUILD.gn deleted file mode 100644 index d5b6111668182b8659d07e6b5b96c2462ff2619a..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesremoteobject_fuzzer/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# 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 = toolchain_output_path - - fuzz_config_file = - "//arkcompiler/toolchain/test/fuzztest/pttypesremoteobject_fuzzer" - - sources = [ "pttypesremoteobject_fuzzer.cpp" ] - - configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - - deps = [ "../../../tooling:libark_ecma_debugger_set" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ - "cJSON:cjson", - "ets_runtime:libark_jsruntime", - "icu:shared_icuuc", - "libuv:uv", - sdk_libc_secshared_dep, - ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":PtTypesRemoteObjectFuzzTest" ] -} diff --git a/test/fuzztest/pttypesremoteobject_fuzzer/corpus/init b/test/fuzztest/pttypesremoteobject_fuzzer/corpus/init deleted file mode 100644 index b9a20c8eb6a74b442cec3b244a433adbfa9414a2..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesremoteobject_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# 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 deleted file mode 100644 index f7de9064465d473bb8e10fc88f0764eaad2d6112..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesremoteobject_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 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 deleted file mode 100644 index 9662e82343f5c5c0597d48fcc6050247eacf8987..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesremoteobject_fuzzer/pttypesremoteobject_fuzzer.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 deleted file mode 100644 index 8ef2e3f558bd0a5acd3b3c40141321da4fe535c1..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesremoteobject_fuzzer/pttypesremoteobject_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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/pttypesremoteobjectgettype_fuzzer/pttypesremoteobjectgettype_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectgettype_fuzzer/pttypesremoteobjectgettype_fuzzer.cpp index c5f7d02d3b72ca3008e373e7e4fb2105ccc85a82..752af381c0e1d0912e627ff0964e5695852a6ccd 100644 --- a/test/fuzztest/pttypesremoteobjectgettype_fuzzer/pttypesremoteobjectgettype_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjectgettype_fuzzer/pttypesremoteobjectgettype_fuzzer.cpp @@ -31,6 +31,7 @@ namespace OHOS { return; } RemoteObject obj; + obj.SetType(std::string((const char*)data, size)); std::string type = obj.GetType(); JSNApi::DestroyJSVM(vm); } diff --git a/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/pttypesremoteobjectgetvalue_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/pttypesremoteobjectgetvalue_fuzzer.cpp index 761a78d2a61558674a2a4994606eb1115075df7d..fd4a214bf6aa453e683d1ac0480546c5dacc99af 100644 --- a/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/pttypesremoteobjectgetvalue_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/pttypesremoteobjectgetvalue_fuzzer.cpp @@ -30,9 +30,18 @@ namespace OHOS { if (size <= 0 || data == NULL) { return; } + double input = 0; + const uint32_t doubleTypeSize = 8; // 8 : size of double type + if (size > doubleTypeSize) { + size = doubleTypeSize; + } + if (memcpy_s(&input, doubleTypeSize, data, size) != 0) { + std::cout << "memcpy_s failed"; + UNREACHABLE(); + } + Local value(NumberRef::New(vm, input)); RemoteObject obj; - Local val = JSValueRef::Undefined(vm); - obj.SetValue(val); + obj.SetValue(value); Local ref = obj.GetValue(); ref.IsEmpty(); obj.HasValue(); diff --git a/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/pttypesremoteobjecthasclassname_fuzzer.cpp b/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/pttypesremoteobjecthasclassname_fuzzer.cpp index f560041e399c9f45255e71e9818acf1740b89d7a..b755df7b28fb682ba89eea77dfd61f97a130daf2 100644 --- a/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/pttypesremoteobjecthasclassname_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/pttypesremoteobjecthasclassname_fuzzer.cpp @@ -31,6 +31,7 @@ namespace OHOS { return; } RemoteObject obj; + obj.SetClassName(std::string((const char*)data, size)); obj.HasClassName(); JSNApi::DestroyJSVM(vm); } diff --git a/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/pttypesremoteobjecthassubtype_fuzzer.cpp b/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/pttypesremoteobjecthassubtype_fuzzer.cpp index d34ce6e569ef2c0ab76ac4ac99f3101de813c5ab..1188948d61a990ba0a341252477157f6bdedfd59 100644 --- a/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/pttypesremoteobjecthassubtype_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/pttypesremoteobjecthassubtype_fuzzer.cpp @@ -31,6 +31,7 @@ namespace OHOS { return; } RemoteObject obj; + obj.SetSubType(std::string((const char*)data, size)); obj.HasSubType(); JSNApi::DestroyJSVM(vm); } diff --git a/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/BUILD.gn deleted file mode 100644 index f9ec501774a5ccacbc1ab0980347c1f96d8d22c1..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# 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 = toolchain_output_path - - fuzz_config_file = - "//arkcompiler/toolchain/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer" - - sources = [ "pttypesremoteobjectsetvalue_fuzzer.cpp" ] - - configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - - deps = [ "../../../tooling:libark_ecma_debugger_set" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ - "cJSON:cjson", - "ets_runtime:libark_jsruntime", - "icu:shared_icuuc", - "libuv:uv", - sdk_libc_secshared_dep, - ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":PtTypesRemoteObjectSetValueFuzzTest" ] -} diff --git a/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/corpus/init b/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/corpus/init deleted file mode 100644 index b9a20c8eb6a74b442cec3b244a433adbfa9414a2..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# 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 deleted file mode 100644 index f7de9064465d473bb8e10fc88f0764eaad2d6112..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 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 deleted file mode 100644 index 95f67506b704f488f87828434d383ac608f620a6..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/pttypesremoteobjectsetvalue_fuzzer.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 deleted file mode 100644 index 297025bedd4134e57559870e3346825e7a52514e..0000000000000000000000000000000000000000 --- a/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/pttypesremoteobjectsetvalue_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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