[Mesa-dev] [PATCH 05/12] glsl/linker: link error on too many subroutine functions.

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


From: Dave Airlie <airlied at redhat.com>

This fixes:
GL45-CTS.explicit_uniform_location.subroutine-index-negative-link-max-num-of-indices

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/compiler/glsl/linker.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index ef8db56..4c567fc 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4229,6 +4229,10 @@ link_assign_subroutine_types(struct gl_shader_program *prog)
          if (!fn->num_subroutine_types)
             continue;
 
+         if (sh->NumSubroutineFunctions + 1 > MAX_SUBROUTINES) {
+            linker_error(prog, "Too many subroutine functions declared.\n");
+            return;
+         }
          sh->SubroutineFunctions = reralloc(sh, sh->SubroutineFunctions,
                                             struct gl_subroutine_function,
                                             sh->NumSubroutineFunctions + 1);
-- 
2.5.5



More information about the mesa-dev mailing list