Mesa (master): mesa: if maxLevels==0, target is invalid

Brian Paul brianp at kemper.freedesktop.org
Thu Aug 13 18:54:01 UTC 2009


Module: Mesa
Branch: master
Commit: 423a53f635f82233e9a570bfc132edc51f7548bb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=423a53f635f82233e9a570bfc132edc51f7548bb

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Aug 13 10:16:59 2009 -0600

mesa: if maxLevels==0, target is invalid

---

 src/mesa/main/texgetimage.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 2d3b82d..14d6fc7 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -373,7 +373,10 @@ getteximage_error_check(GLcontext *ctx, GLenum target, GLint level,
    struct gl_texture_image *texImage;
    const GLuint maxLevels = _mesa_max_texture_levels(ctx, target);
 
-   ASSERT(maxLevels > 0);  /* 0 indicates bad target, caught above */
+   if (maxLevels == 0) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target=0x%x)", target);
+      return GL_TRUE;
+   }
 
    if (level < 0 || level >= maxLevels) {
       _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexImage(level)" );




More information about the mesa-commit mailing list