SWDEV-344168 - Fix hipMemsetAsync API crash

- Return hipErrorInvalidValue if memset size + offset is crossing
  allocated memory size

Change-Id: I18bd7bcf90ccfce992acb4535a00a8560c0f684b
Esse commit está contido em:
Rakesh Roy
2022-07-07 20:17:16 +05:30
commit de Rakesh Roy
commit 4e6e175f16
+2 -2
Ver Arquivo
@@ -2493,7 +2493,7 @@ 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) {
if (memory->getSize() < (offset + sizeBytes)) {
return hipErrorInvalidValue;
}
return hipSuccess;
@@ -2641,7 +2641,7 @@ hipError_t ihipMemset3D_validate(hipPitchedPtr pitchedDevPtr, int value, hipExte
if (memory == nullptr) {
return hipErrorInvalidValue;
}
if (sizeBytes > memory->getSize()) {
if ((sizeBytes + offset) > memory->getSize()) {
return hipErrorInvalidValue;
}
if (pitchedDevPtr.pitch == memory->getUserData().pitch_) {