mesa: check for invalid index on UUID glGet queries
authorAndres Rodriguez <andresx7@gmail.com>
Fri, 22 Dec 2017 00:18:59 +0000 (19:18 -0500)
committerAndres Rodriguez <andresx7@gmail.com>
Tue, 30 Jan 2018 20:13:49 +0000 (15:13 -0500)
This fixes the piglit test:
spec/ext_semaphore/api-errors/usigned-byte-i-v-bad-value

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

index 1e4b8f6f0bceb3ef61e625fd71a6584d367e46a2..cf9a2f66d2f288d890652cefb25dae58119c940a 100644 (file)
@@ -2578,9 +2578,13 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
       v->value_int = 1;
       return TYPE_INT;
    case GL_DRIVER_UUID_EXT:
+      if (index >= 1)
+         goto invalid_value;
       _mesa_get_driver_uuid(ctx, v->value_int_4);
       return TYPE_INT_4;
    case GL_DEVICE_UUID_EXT:
+      if (index >= 1)
+         goto invalid_value;
       _mesa_get_device_uuid(ctx, v->value_int_4);
       return TYPE_INT_4;
    }