Commit 0bbd11c1 by Geoff Lang

Fix Texture2DArray calling Texture::set/subImage with invalid pointers when the…

Fix Texture2DArray calling Texture::set/subImage with invalid pointers when the pixels pointer is NULL. TRAC #23767 Author: Geoff Lang Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods
parent c144974c
#define MAJOR_VERSION 2
#define MINOR_VERSION 0
#define BUILD_VERSION 0
#define BUILD_REVISION 2006
#define BUILD_REVISION 2007
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
......
......@@ -2214,7 +2214,7 @@ void Texture2DArray::setImage(GLint level, GLsizei width, GLsizei height, GLsize
for (int i = 0; i < depth; i++)
{
const void *layerPixels = reinterpret_cast<const unsigned char*>(pixels) + (inputDepthPitch * i);
const void *layerPixels = pixels ? (reinterpret_cast<const unsigned char*>(pixels) + (inputDepthPitch * i)) : NULL;
Texture::setImage(unpackAlignment, type, layerPixels, mImageArray[level][i]);
}
}
......@@ -2229,7 +2229,7 @@ void Texture2DArray::setCompressedImage(GLint level, GLenum format, GLsizei widt
for (int i = 0; i < depth; i++)
{
const void *layerPixels = reinterpret_cast<const unsigned char*>(pixels) + (inputDepthPitch * i);
const void *layerPixels = pixels ? (reinterpret_cast<const unsigned char*>(pixels) + (inputDepthPitch * i)) : NULL;
Texture::setCompressedImage(imageSize, layerPixels, mImageArray[level][i]);
}
}
......@@ -2243,7 +2243,7 @@ void Texture2DArray::subImage(GLint level, GLint xoffset, GLint yoffset, GLint z
for (int i = 0; i < depth; i++)
{
int layer = zoffset + i;
const void *layerPixels = reinterpret_cast<const unsigned char*>(pixels) + (inputDepthPitch * i);
const void *layerPixels = pixels ? (reinterpret_cast<const unsigned char*>(pixels) + (inputDepthPitch * i)) : NULL;
if (Texture::subImage(xoffset, yoffset, zoffset, width, height, 1, format, type, unpackAlignment, layerPixels, mImageArray[level][layer]))
{
......@@ -2260,7 +2260,7 @@ void Texture2DArray::subImageCompressed(GLint level, GLint xoffset, GLint yoffse
for (int i = 0; i < depth; i++)
{
int layer = zoffset + i;
const void *layerPixels = reinterpret_cast<const unsigned char*>(pixels) + (inputDepthPitch * i);
const void *layerPixels = pixels ? (reinterpret_cast<const unsigned char*>(pixels) + (inputDepthPitch * i)) : NULL;
if (Texture::subImageCompressed(xoffset, yoffset, zoffset, width, height, 1, format, imageSize, layerPixels, mImageArray[level][layer]))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment