summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/texobj.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 2a54ff7ff90..d8e8b559f53 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -383,6 +383,18 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
t->_Complete = GL_TRUE; /* be optimistic */
+ /* Detect cases where the application set the base level to an invalid
+ * value.
+ */
+ if ((baseLevel < 0) || (baseLevel > MAX_TEXTURE_LEVELS)) {
+ char s[100];
+ _mesa_sprintf(s, "obj %p (%d) base level = %d is invalid",
+ (void *) t, t->Name, baseLevel);
+ incomplete(t, s);
+ t->_Complete = GL_FALSE;
+ return;
+ }
+
/* Always need the base level image */
if (!t->Image[0][baseLevel]) {
char s[100];