mesa: Handle negative length in glPushDebugGroup().
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 24 Mar 2016 06:46:12 +0000 (23:46 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 24 Mar 2016 17:47:50 +0000 (10:47 -0700)
The KHR_debug spec doesn't actually say we should handle this, but that
is most likely an oversight - it says to check against strlen and
generate errors if length is negative.  It appears they just forgot to
explicitly spell out that we should then proceed to actually handle it.

Fixes crashes from uncaught std::string exceptions in many
dEQP-GLES31.functional.debug.error_filters.* tests.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
src/mesa/main/debug_output.c

index 001f63ea94defedf24f75ddb4d96469bd3c73c32..85f64bd459fd5a69a839ac81a18f4d6aa98a7f71 100644 (file)
@@ -1189,6 +1189,9 @@ _mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei length,
    if (!validate_length(ctx, callerstr, length, message))
       return; /* GL_INVALID_VALUE */
 
+   if (length < 0)
+      length = strlen(message);
+
    debug = _mesa_lock_debug_state(ctx);
    if (!debug)
       return;