mesa: clamp binary pointer in ShaderBinary if length==0

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 <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28501>
This commit is contained in:
Mike Blumenkrantz 2024-04-01 09:39:15 -04:00 committed by Marge Bot
parent 6e91c88036
commit 37be4bf1b7

View file

@ -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:
*