From f6a5cd9e33593d55d1be8d6b1e78db1f409ae6d6 Mon Sep 17 00:00:00 2001 From: Jaydeep Patel Date: Mon, 2 Jan 2023 11:12:52 +0000 Subject: [PATCH] SWDEV-374373 - Occupied size should be within range. Change-Id: I20e24c628c51154c2f8f36dca0a6fa4ead1ee6d0 [ROCm/clr commit: 67792dd858504bb3d50f2099effc47c3dc8a6eca] --- projects/clr/hipamd/src/hip_memory.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/clr/hipamd/src/hip_memory.cpp b/projects/clr/hipamd/src/hip_memory.cpp index b3c8865380..116ecb103d 100644 --- a/projects/clr/hipamd/src/hip_memory.cpp +++ b/projects/clr/hipamd/src/hip_memory.cpp @@ -2760,6 +2760,14 @@ hipError_t ihipGraphMemsetParams_validate(const hipMemsetParams* pNodeParams) { if (pNodeParams->height <= 0) { return hipErrorInvalidValue; } + + amd::Memory *memObj = amd::MemObjMap::FindMemObj(pNodeParams->dst); + if (memObj != nullptr) { + if ((pNodeParams->pitch * pNodeParams->height) > memObj->getSize()) { + return hipErrorInvalidValue; + } + } + return hipSuccess; }