SWDEV-374372 - Return invalid value if pitch is less than width in bytes.

Change-Id: I33806d747cd344250d02e217de8e9b6d5a7f83c1


[ROCm/clr commit: 7c32f66e67]
このコミットが含まれているのは:
Jaydeep Patel
2022-12-25 13:56:58 +00:00
committed by Jaydeepkumar Patel
コミット f9574cd645
+7 -1
ファイルの表示
@@ -134,7 +134,10 @@ hipError_t ihipGraphAddMemsetNode(hipGraphNode_t* pGraphNode, hipGraph_t graph,
ihipMemset_validate(pMemsetParams->dst, pMemsetParams->value, pMemsetParams->elementSize,
pMemsetParams->width * pMemsetParams->elementSize);
} else {
auto sizeBytes = pMemsetParams->width * pMemsetParams->height * 1;
if (pMemsetParams->pitch < (pMemsetParams->width * pMemsetParams->elementSize)) {
return hipErrorInvalidValue;
}
auto sizeBytes = pMemsetParams->width * pMemsetParams->height * pMemsetParams->elementSize * 1;
status = ihipMemset3D_validate(
{pMemsetParams->dst, pMemsetParams->pitch, pMemsetParams->width, pMemsetParams->height},
pMemsetParams->value, {pMemsetParams->width, pMemsetParams->height, 1}, sizeBytes);
@@ -1363,6 +1366,9 @@ hipError_t hipGraphMemsetNodeSetParams(hipGraphNode_t node, const hipMemsetParam
if (node == nullptr || pNodeParams == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
if (pNodeParams->height > 1 && pNodeParams->pitch < (pNodeParams->width * pNodeParams->elementSize)) {
return hipErrorInvalidValue;
}
HIP_RETURN(reinterpret_cast<hipGraphMemsetNode*>(node)->SetParams(pNodeParams));
}