summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaura Ekstrand <[email protected]>2015-03-04 10:49:55 -0800
committerLaura Ekstrand <[email protected]>2015-03-09 13:33:53 -0700
commit1ee000a0b6737d6c140d4f07b6044908b8ebfdc7 (patch)
tree5b07bee91ca4d546b14a9bbe3384fd9339e99d98
parentc939231e7223510408a446400ad23b8b5ce2922e (diff)
main: _mesa_cube_level_complete checks NumLayers.
_mesa_cube_level_complete now verifies that a cube map texture object actually has six texture images before proceeding. Reviewed-by: Anuj Phogat <[email protected]>
-rw-r--r--src/mesa/main/texobj.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index e018ab9103c..a99b108d35f 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -879,6 +879,10 @@ _mesa_cube_level_complete(const struct gl_texture_object *texObj,
if (texObj->Target != GL_TEXTURE_CUBE_MAP)
return GL_FALSE;
+ /* Make sure we have enough image planes for a cube map. */
+ if (texObj->NumLayers < 6)
+ return GL_FALSE;
+
if ((level < 0) || (level >= MAX_TEXTURE_LEVELS))
return GL_FALSE;