mesa: fix incorrect size/error test in _mesa_GetUnsignedBytevEXT()
authorBrian Paul <brianp@vmware.com>
Mon, 29 Jan 2018 21:19:44 +0000 (14:19 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 30 Jan 2018 04:15:52 +0000 (21:15 -0700)
get_value_size() returns -1 for an error.  The similar check in
_mesa_GetUnsignedBytei_vEXT() is correct.

Found by chance.  There are apparently no Piglit tests which exercise
glGetUnsignedBytei_vEXT() or glGetUnsignedBytevEXT().

Reviewed-by: Andres Rodriguez <andresx7@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/main/get.c

index 5fee9a60bc323b739d2b7aac76344a7e3d4ccba9..bafd1e35b294ab5dbf26c1222f6fcaf6252ea7e4 100644 (file)
@@ -2064,7 +2064,7 @@ _mesa_GetUnsignedBytevEXT(GLenum pname, GLubyte *data)
 
    d = find_value(func, pname, &p, &v);
    size = get_value_size(d->type, &v);
-   if (size >= 0) {
+   if (size <= 0) {
       _mesa_problem(ctx, "invalid value type in GetUnsignedBytevEXT()");
    }