[Mesa-dev] [PATCH] mesa: check width and height in copyteximage

Marek Olšák maraeo at gmail.com
Sun Mar 3 06:58:38 PST 2013


This WebGL test sets width and height to 0:
https://www.khronos.org/registry/webgl/sdk/tests/conformance/misc/type-conversion-test.html

It causes assertion failures in the state tracker.
---
 src/mesa/main/teximage.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 0dcf88a..7ec5fdb 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3453,6 +3453,10 @@ copyteximage(struct gl_context *ctx, GLuint dims,
       return;
    }
 
+   if (!width || !height) {
+      return; /* undefined behavior? */
+   }
+
    texObj = _mesa_get_current_tex_object(ctx, target);
    assert(texObj);
 
-- 
1.7.10.4



More information about the mesa-dev mailing list