summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2016-03-06 12:19:04 -0500
committerEmil Velikov <[email protected]>2016-03-12 01:17:20 +0000
commit41dbfcd1cd67dd043f6815c6ddf2eeddd815872e (patch)
treecbc15eaff561181ff34fb558073048080a7440e2 /src/compiler
parent1e9d8fa8a81abd01d935d381a59ce87c91a595ea (diff)
glsl: avoid stack smashing when there are too many attributes
This fixes a crash in dEQP-GLES3.functional.transform_feedback.array_element.separate.points.lowp_mat3x2 and likely others. The vertex shader has > 16 input variables (without explicit locations), which causes us to index outside of the to_assign array. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Cc: "11.1 11.2" <[email protected]> (cherry picked from commit f6827e20d12ab062440bc809b8f2338b68edac45)
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/linker.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 3039232162a..4cec1077025 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -2625,6 +2625,13 @@ assign_attribute_or_color_locations(gl_shader_program *prog,
continue;
}
+ if (num_attr >= ARRAY_SIZE(to_assign)) {
+ linker_error(prog, "too many %s (max %u)",
+ target_index == MESA_SHADER_VERTEX ?
+ "vertex shader inputs" : "fragment shader outputs",
+ (unsigned)ARRAY_SIZE(to_assign));
+ return false;
+ }
to_assign[num_attr].slots = slots;
to_assign[num_attr].var = var;
num_attr++;