diff --git a/base/test/fuzztest/ashmem_fuzzer/ashmem_fuzzer.cpp b/base/test/fuzztest/ashmem_fuzzer/ashmem_fuzzer.cpp index 1c5e34b3be828bfc3c6fe724a3aacc48fa359980..62f2e7ca5c10653bf51d036fc11b4a849bd6b593 100644 --- a/base/test/fuzztest/ashmem_fuzzer/ashmem_fuzzer.cpp +++ b/base/test/fuzztest/ashmem_fuzzer/ashmem_fuzzer.cpp @@ -38,24 +38,20 @@ void AshmemTestFunc(FuzzedDataProvider* dataProvider) } string memoryContent = dataProvider->ConsumeRandomLengthString(MAX_MEMORY_SIZE); - ret = ashmem->WriteToAshmem(memoryContent.c_str(), sizeof(memoryContent), 0); + ret = ashmem->WriteToAshmem(memoryContent.c_str(), memoryContent.size(), 0); if (ret != true) { return; } string memoryContent2 = dataProvider->ConsumeRandomLengthString(MAX_MEMORY_SIZE); - ret = ashmem->WriteToAshmem(memoryContent2.c_str(), sizeof(memoryContent2), sizeof(memoryContent2)); + ret = ashmem->WriteToAshmem(memoryContent2.c_str(), memoryContent2.size(), memoryContent.size()); if (ret != true) { return; } - auto readData = ashmem->ReadFromAshmem(sizeof(memoryContent), 0); + ashmem->ReadFromAshmem(memoryContent.size(), 0); - const char *readContent = reinterpret_cast(readData); - - readData = ashmem->ReadFromAshmem(sizeof(memoryContent2), sizeof(memoryContent2)); - - readContent = reinterpret_cast(readData); + ashmem->ReadFromAshmem(memoryContent2.size(), memoryContent.size()); int prot = dataProvider->ConsumeIntegral(); ashmem->SetProtection(prot); diff --git a/base/test/fuzztest/thread_fuzzer/thread_fuzzer.cpp b/base/test/fuzztest/thread_fuzzer/thread_fuzzer.cpp index ddeef6a9ea29ea42c2f542f335e3061d31698ddd..5bd82e01749399db6566549a0266d03c8ed77f20 100644 --- a/base/test/fuzztest/thread_fuzzer/thread_fuzzer.cpp +++ b/base/test/fuzztest/thread_fuzzer/thread_fuzzer.cpp @@ -28,7 +28,7 @@ using namespace std; namespace OHOS { const std::string& DEFAULT_THREAD_NAME = "default"; -const int MAX_STACK_SIZE = 4096; +const int MAX_STACK_SIZE = 1024; const int MAX_PRIORITY = 10; using ThreadRunFunc = bool (*)(int& data);