[Mesa-dev] [PATCH 01/12] arb_shader_subroutine: check active subroutine limit

Dave Airlie airlied at gmail.com
Mon May 23 00:52:31 UTC 2016


From: Dave Airlie <airlied at redhat.com>

_mesa_GetActiveSubroutineUniformiv needs to check
against the number of types here.

Noticed while playing with ogl conform.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/mesa/main/shaderapi.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 3c85b41..109171e 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);
-- 
2.5.5



More information about the mesa-dev mailing list