From ce41fd9824f6ea0a03eb1342271d6e2c1461653c Mon Sep 17 00:00:00 2001 From: Sarbojit Sarkar Date: Wed, 31 Mar 2021 04:31:19 -0700 Subject: [PATCH] SWDEV-276319 - Added null checks Change-Id: Ib22a333f0f599c8f0efca34f2a287bc4b118d743 [ROCm/clr commit: 4af7a744827c5736d0d3594aa6b571b63168c5e5] --- projects/clr/hipamd/rocclr/hip_memory.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/clr/hipamd/rocclr/hip_memory.cpp b/projects/clr/hipamd/rocclr/hip_memory.cpp index e28b9e05d8..e1f937ae35 100755 --- a/projects/clr/hipamd/rocclr/hip_memory.cpp +++ b/projects/clr/hipamd/rocclr/hip_memory.cpp @@ -1574,6 +1574,9 @@ hipError_t ihipMemcpyAtoH(hipArray* srcArray, hipError_t ihipMemcpyParam3D(const HIP_MEMCPY3D* pCopy, hipStream_t stream, bool isAsync = false) { + if (pCopy == nullptr) { + return hipErrorInvalidValue; + } if(pCopy->WidthInBytes == 0 || pCopy->Height == 0 || pCopy->Depth == 0) { LogPrintfInfo("Either Width :%d or Height: %d and Depth: %d is zero", pCopy->WidthInBytes, pCopy->Height, pCopy->Depth); @@ -1834,7 +1837,7 @@ hipError_t ihipMemcpy3D(const hipMemcpy3DParms* p, bool isAsync = false) { // The struct passed to hipMemcpy3D() must specify one of srcArray or srcPtr and one of dstArray or dstPtr. // Passing more than one non-zero source or destination will cause hipMemcpy3D() to return an error. - if (((p->srcArray != nullptr) && (p->srcPtr.ptr != nullptr)) || + if (p == nullptr || ((p->srcArray != nullptr) && (p->srcPtr.ptr != nullptr)) || ((p->dstArray != nullptr) && (p->dstPtr.ptr != nullptr))) { return hipErrorInvalidValue; }