From: Dave Airlie Date: Tue, 28 Jul 2015 06:11:06 +0000 (+0100) Subject: arb_shader_subroutine: check active subroutine limit X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ba3414d832c0661e6b827641dbd33a2829d1812e;p=mesa.git 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 --- 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);