[20/20] mesa: check for invalid index on UUID glGet queries

Submitted by Andres Rodriguez on Jan. 23, 2018, 6:05 p.m.

Details

Message ID 20180123180510.10180-21-andresx7@gmail.com
State New
Headers show
Series "Add support for GL_EXT_semaphore" ( rev: 5 4 3 ) in Mesa

Not browsing as part of any series.

Commit Message

Andres Rodriguez Jan. 23, 2018, 6:05 p.m.
This fixes the piglit test:
spec/ext_semaphore/api-errors/usigned-byte-i-v-bad-value

Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
---
 src/mesa/main/get.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 34970b8e16..302cece3ef 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -2547,9 +2547,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;
    }