From 432ac19c1ad34f32bdcfe6ec7823383ee24eb016 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 17 May 2016 14:52:38 +1000 Subject: [PATCH] glsl/linker: link error on too many subroutine functions. This fixes: GL45-CTS.explicit_uniform_location.subroutine-index-negative-link-max-num-of-indices Reviewed-by: Chris Forbes Signed-off-by: Dave Airlie --- 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 ef8db563bb2..4c567fca549 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.30.2