From 376f5155477cd93da58c1e52feff685d5e715c0e Mon Sep 17 00:00:00 2001 From: Jaydeep Patel Date: Wed, 21 Dec 2022 18:07:00 +0000 Subject: [PATCH] SWDEV-374398 - Pitch should not be less than width for both src and dst. Change-Id: Ib8fa8e3bd0c655f3de213b3798d369ba866b2f01 [ROCm/clr commit: c4003ef62a2b9d5bf1f3e2812b40d58f98434568] --- projects/clr/hipamd/src/hip_memory.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/clr/hipamd/src/hip_memory.cpp b/projects/clr/hipamd/src/hip_memory.cpp index dc8b3464c9..1a6272c7f9 100644 --- a/projects/clr/hipamd/src/hip_memory.cpp +++ b/projects/clr/hipamd/src/hip_memory.cpp @@ -2496,6 +2496,11 @@ hipError_t ihipMemcpy3D_validate(const hipMemcpy3DParms* p) { (hip::getElementSize(p->dstArray) != hip::getElementSize(p->dstArray))) { return hipErrorInvalidValue; } + + // Pitch should not be less than width for both src and dst. + if (p->srcPtr.pitch < p->srcPtr.xsize || p->dstPtr.pitch < p->dstPtr.xsize) { + return hipErrorInvalidPitchValue; + } return hipSuccess; }