SWDEV-475127 - Check if hipBindTextureToArray parameters are null before dereferencing them

Change-Id: Id0173faff0a385d1665194c9033083ef9b2c48b5


[ROCm/clr commit: d7b07b94a0]
Этот коммит содержится в:
Vladana Stojiljkovic
2024-07-25 17:00:29 +02:00
родитель 42e8d3c894
Коммит 6fcb2c655f
+4 -6
Просмотреть файл
@@ -633,12 +633,6 @@ hipError_t hipBindTexture2D(size_t* offset,
hipError_t ihipBindTextureToArray(const textureReference* texref,
hipArray_const_t array,
const hipChannelFormatDesc* desc) {
if ((texref == nullptr) ||
(array == nullptr) ||
(desc == nullptr)) {
return hipErrorInvalidValue;
}
// Any previous address or HIP array state associated with the texture reference is superseded by this function.
// Any memory previously bound to hTexRef is unbound.
// No need to check for errors.
@@ -664,6 +658,10 @@ hipError_t hipBindTextureToArray(const textureReference* texref,
const hipChannelFormatDesc* desc) {
HIP_INIT_API(hipBindTextureToArray, texref, array, desc);
if ((texref == nullptr) || (array == nullptr) || (desc == nullptr)) {
return hipErrorInvalidValue;
}
hipDeviceptr_t refDevPtr = nullptr;
size_t refDevSize = 0;
HIP_RETURN_ONFAIL(PlatformState::instance().getStatGlobalVar(texref, ihipGetDevice(), &refDevPtr,