From 83e2a8a892fc30bd2e1d0349352144644cfb9573 Mon Sep 17 00:00:00 2001 From: Satyanvesh Dittakavi Date: Tue, 5 Apr 2022 14:30:16 +0000 Subject: [PATCH] SWDEV-326796 - Fix hipMemset crash when the size passed is more than allocated Change-Id: If3b15da0960f3af347fca62beedd8003cb958c2e [ROCm/clr commit: c0ada4320b9b919e90526493e6771c3ab1360bd5] --- projects/clr/hipamd/src/hip_memory.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/clr/hipamd/src/hip_memory.cpp b/projects/clr/hipamd/src/hip_memory.cpp index b2039d86c4..8fb7b00072 100644 --- a/projects/clr/hipamd/src/hip_memory.cpp +++ b/projects/clr/hipamd/src/hip_memory.cpp @@ -2287,6 +2287,9 @@ hipError_t ihipMemset_validate(void* dst, int64_t value, size_t valueSize, // dst ptr is host ptr hence error return hipErrorInvalidValue; } + if (memory->getSize() < sizeBytes) { + return hipErrorInvalidValue; + } return hipSuccess; }