From 37be4bf1b757144a67da08b3ebcb5256fc611925 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 1 Apr 2024 09:39:15 -0400 Subject: [PATCH] mesa: clamp binary pointer in ShaderBinary if length==0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this pointer is only valid if length is valid fixes dEQP-GL45-ES3.functional.negative_api.shader.shader_binary with glthread enabled fixes #10915 cc: mesa-stable Reviewed-by: Marek Olšák Part-of: --- src/mesa/main/shaderapi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index c5b0d8b5d72..81f2b11e685 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -2361,6 +2361,10 @@ _mesa_ShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, GET_CURRENT_CONTEXT(ctx); struct gl_shader **sh; + /* no binary data can be loaded if length==0 */ + if (!length) + binary = NULL; + /* Page 68, section 7.2 'Shader Binaries" of the of the OpenGL ES 3.1, and * page 88 of the OpenGL 4.5 specs state: *