From 8ea74366d77c8d51f7deae943e16b239caac7874 Mon Sep 17 00:00:00 2001 From: Rakesh Roy Date: Wed, 20 Apr 2022 19:49:30 +0530 Subject: [PATCH] SWDEV-332603 - Check validity of ihipArrayCreate() first argument Change-Id: Ifd0bdb5708c110da45e4baa9426cccd749732822 --- hipamd/src/hip_memory.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hipamd/src/hip_memory.cpp b/hipamd/src/hip_memory.cpp index ef08b92955..510307b2ba 100644 --- a/hipamd/src/hip_memory.cpp +++ b/hipamd/src/hip_memory.cpp @@ -866,6 +866,10 @@ amd::Image* ihipImageCreate(const cl_channel_order channelOrder, hipError_t ihipArrayCreate(hipArray** array, const HIP_ARRAY3D_DESCRIPTOR* pAllocateArray, unsigned int numMipmapLevels) { + if (array == nullptr) { + return hipErrorInvalidValue; + } + // NumChannels specifies the number of packed components per HIP array element; it may be 1, 2, or 4; if ((pAllocateArray->NumChannels != 1) && (pAllocateArray->NumChannels != 2) &&