From: Lionel Landwerlin Date: Tue, 24 Mar 2020 14:54:32 +0000 (+0200) Subject: i965/iris: fix crash when calling GetPerfQueryDataINTEL X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ba56684a14101820a8f8d6ebf8682e12a383288d;p=mesa.git i965/iris: fix crash when calling GetPerfQueryDataINTEL On a query that was never begun. Signed-off-by: Lionel Landwerlin Reviewed-by: Rafael Antognolli Tested-by: Marge Bot Part-of: --- diff --git a/src/mesa/main/performance_query.c b/src/mesa/main/performance_query.c index 1eaf0bb1a76..c5825a7da3a 100644 --- a/src/mesa/main/performance_query.c +++ b/src/mesa/main/performance_query.c @@ -617,6 +617,15 @@ _mesa_GetPerfQueryDataINTEL(GLuint queryHandle, GLuint flags, */ *bytesWritten = 0; + /* Not explicitly covered in the spec but a query that was never started + * cannot return any data. + */ + if (!obj->Used) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetPerfQueryDataINTEL(query never began)"); + return; + } + /* Not explicitly covered in the spec but to be consistent with * EndPerfQuery which validates that an application only ends an * active query we also validate that an application doesn't try