diff --git a/projects/clr/hipamd/src/hip_memory.cpp b/projects/clr/hipamd/src/hip_memory.cpp index 482ca6cf66..624885a022 100644 --- a/projects/clr/hipamd/src/hip_memory.cpp +++ b/projects/clr/hipamd/src/hip_memory.cpp @@ -3725,6 +3725,12 @@ hipError_t ihipPointerGetAttributes(void* data, hipPointer_attribute attribute, ((CL_MEM_SVM_FINE_GRAIN_BUFFER | CL_MEM_USE_HOST_PTR) & memObj->getMemFlags())? hipMemoryTypeHost : hipMemoryTypeDevice; } else { // checks for array type + // ptr must be a host allocation using malloc since memObj is null and is + // not found in hipArraySet. + if (hip::hipArraySet.find(static_cast(ptr)) == hip::hipArraySet.end()) { + *reinterpret_cast(data) = 0; + return hipErrorInvalidValue; + } cl_mem dstMemObj = reinterpret_cast((static_cast(ptr))->data); if (!is_valid(dstMemObj)) { *reinterpret_cast(data) = 0;