From de626141ee06e8d512afced0d7f7ccefb527e5c3 Mon Sep 17 00:00:00 2001 From: pghafari Date: Fri, 20 May 2022 23:02:49 -0400 Subject: [PATCH] SWDEV-337703 - nullptr check for hipMallocArray Change-Id: I3b1077e236ccda346d337109014ef7fd2e693ec6 [ROCm/clr commit: 8e28413a9ef1d25d1faaf732b0103723e62c55b7] --- projects/clr/hipamd/src/hip_memory.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/clr/hipamd/src/hip_memory.cpp b/projects/clr/hipamd/src/hip_memory.cpp index 50c44c5ce8..607404d8bd 100644 --- a/projects/clr/hipamd/src/hip_memory.cpp +++ b/projects/clr/hipamd/src/hip_memory.cpp @@ -971,6 +971,9 @@ hipError_t hipMallocArray(hipArray** array, size_t height, unsigned int flags) { HIP_INIT_API(hipMallocArray, array, desc, width, height, flags); + if (array == nullptr || desc == nullptr) { + return hipErrorInvalidValue; + } CHECK_STREAM_CAPTURE_SUPPORTED(); HIP_ARRAY3D_DESCRIPTOR allocateArray = {width, height, @@ -996,6 +999,9 @@ hipError_t hipMalloc3DArray(hipArray_t* array, hipExtent extent, unsigned int flags) { HIP_INIT_API(hipMalloc3DArray, array, desc, extent, flags); + if (array == nullptr || desc == nullptr) { + return hipErrorInvalidValue; + } CHECK_STREAM_CAPTURE_SUPPORTED(); HIP_ARRAY3D_DESCRIPTOR allocateArray = {extent.width, extent.height,