From: Laura Ekstrand Date: Tue, 6 Jan 2015 22:05:41 +0000 (-0800) Subject: main: Checking for cube completeness in GetCompressedTextureImage. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ff011340a499d9fe5c3ead6b46b917578bfeb533;p=mesa.git main: Checking for cube completeness in GetCompressedTextureImage. v2: Review from Anuj Phogat - Remove redundant copies of the cube map block comment - Replace redundant "if (!texImage) return;" statements with assert(texImage) Reviewed-by: Anuj Phogat --- diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 9411db81614..255d365599a 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -1303,7 +1303,16 @@ _mesa_GetCompressedTextureImage(GLuint texture, GLint level, /* Must handle special case GL_TEXTURE_CUBE_MAP. */ if (texObj->Target == GL_TEXTURE_CUBE_MAP) { - assert(texObj->NumLayers >= 6); + + /* Make sure the texture object is a proper cube. + * (See texturesubimage in teximage.c for details on why this check is + * performed.) + */ + if (!_mesa_cube_level_complete(texObj, level)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetCompressedTextureImage(cube map incomplete)"); + return; + } /* Copy each face. */ for (i = 0; i < 6; ++i) {