mesa/queryobject: return INVALID_VALUE if offset < 0 (v2)
authorDave Airlie <airlied@redhat.com>
Sun, 22 May 2016 21:20:50 +0000 (07:20 +1000)
committerDave Airlie <airlied@redhat.com>
Sun, 22 May 2016 21:33:03 +0000 (07:33 +1000)
This fixes:
GL45-CTS.direct_state_access.queries_errors

The ARB_direct_state_access spec agrees.

v2: move check down further (Ilia)

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/main/queryobj.c

index 7a70b592c479435a48209e2cf88ab46bbf204bd6..1fa02795c1c7c5280b4cde93f8882a0df681aa2b 100644 (file)
@@ -766,6 +766,11 @@ get_query_object(struct gl_context *ctx, const char *func,
          return;
       }
 
+      if (offset < 0) {
+         _mesa_error(ctx, GL_INVALID_VALUE, "%s(offset is negative)", func);
+         return;
+      }
+
       switch (pname) {
       case GL_QUERY_RESULT:
       case GL_QUERY_RESULT_NO_WAIT: