From ba56684a14101820a8f8d6ebf8682e12a383288d Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Tue, 24 Mar 2020 16:54:32 +0200 Subject: [PATCH] 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: --- src/mesa/main/performance_query.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- 2.30.2