From c0ada4320b9b919e90526493e6771c3ab1360bd5 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 --- hipamd/src/hip_memory.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hipamd/src/hip_memory.cpp b/hipamd/src/hip_memory.cpp index b2039d86c4..8fb7b00072 100644 --- a/hipamd/src/hip_memory.cpp +++ b/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; }