SWDEV-475127 - Check if hipBindTextureToArray parameters are null before dereferencing them
Change-Id: Id0173faff0a385d1665194c9033083ef9b2c48b5
[ROCm/clr commit: d7b07b94a0]
This commit is contained in:
@@ -633,12 +633,6 @@ hipError_t hipBindTexture2D(size_t* offset,
|
|||||||
hipError_t ihipBindTextureToArray(const textureReference* texref,
|
hipError_t ihipBindTextureToArray(const textureReference* texref,
|
||||||
hipArray_const_t array,
|
hipArray_const_t array,
|
||||||
const hipChannelFormatDesc* desc) {
|
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 previous address or HIP array state associated with the texture reference is superseded by this function.
|
||||||
// Any memory previously bound to hTexRef is unbound.
|
// Any memory previously bound to hTexRef is unbound.
|
||||||
// No need to check for errors.
|
// No need to check for errors.
|
||||||
@@ -664,6 +658,10 @@ hipError_t hipBindTextureToArray(const textureReference* texref,
|
|||||||
const hipChannelFormatDesc* desc) {
|
const hipChannelFormatDesc* desc) {
|
||||||
HIP_INIT_API(hipBindTextureToArray, texref, array, desc);
|
HIP_INIT_API(hipBindTextureToArray, texref, array, desc);
|
||||||
|
|
||||||
|
if ((texref == nullptr) || (array == nullptr) || (desc == nullptr)) {
|
||||||
|
return hipErrorInvalidValue;
|
||||||
|
}
|
||||||
|
|
||||||
hipDeviceptr_t refDevPtr = nullptr;
|
hipDeviceptr_t refDevPtr = nullptr;
|
||||||
size_t refDevSize = 0;
|
size_t refDevSize = 0;
|
||||||
HIP_RETURN_ONFAIL(PlatformState::instance().getStatGlobalVar(texref, ihipGetDevice(), &refDevPtr,
|
HIP_RETURN_ONFAIL(PlatformState::instance().getStatGlobalVar(texref, ihipGetDevice(), &refDevPtr,
|
||||||
|
|||||||
Reference in New Issue
Block a user