From ba3414d832c0661e6b827641dbd33a2829d1812e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 28 Jul 2015 07:11:06 +0100 Subject: arb_shader_subroutine: check active subroutine limit _mesa_GetActiveSubroutineUniformiv needs to check against the number of types here. Noticed while playing with ogl conform. Reviewed-by: Chris Forbes Signed-off-by: Dave Airlie --- src/mesa/main/shaderapi.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/mesa/main/shaderapi.c') diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 3c85b41c88c..109171ef57a 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -2369,6 +2369,11 @@ _mesa_GetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, return; } + if (index >= sh->NumSubroutineUniformTypes) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s: invalid index greater than GL_ACTIVE_SUBROUTINE_UNIFORMS", api_name); + return; + } + switch (pname) { case GL_NUM_COMPATIBLE_SUBROUTINES: { res = _mesa_program_resource_find_index(shProg, resource_type, index); -- cgit v1.2.3