From d02ec23ff193a870860a792c526613e86fc37725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=88=E7=9A=93=E6=9D=B0?= Date: Thu, 25 Jul 2024 01:55:04 +0000 Subject: [PATCH] update test/fuzztest/distributedschedstub_fuzzer/distributedschedstub_fuzzer.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 师皓杰 --- .../distributedschedstub_fuzzer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/fuzztest/distributedschedstub_fuzzer/distributedschedstub_fuzzer.cpp b/test/fuzztest/distributedschedstub_fuzzer/distributedschedstub_fuzzer.cpp index ae1f6d22..583ea17f 100644 --- a/test/fuzztest/distributedschedstub_fuzzer/distributedschedstub_fuzzer.cpp +++ b/test/fuzztest/distributedschedstub_fuzzer/distributedschedstub_fuzzer.cpp @@ -42,6 +42,10 @@ const uint32_t ONE = 1; uint32_t GetU32Data(const uint8_t* ptr, size_t size) { char *ch = (char *)malloc(size + 1); + if (ch == nullptr) { + std::cout << "malloc failed." << std::endl; + return 0; + } (void)memset_s(ch, size + 1, 0x00, size + 1); if (memcpy_s(ch, size + 1, ptr, size) != EOK) { std::cout << "copy failed." << std::endl;