summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-05-11 12:31:26 +0200
committerSamuel Pitoiset <[email protected]>2017-05-11 21:08:28 +0200
commita29810e27ccfc1de2341ce044a68c9345d53599e (patch)
treea2a4aba4ce7539ab37162526665cde98887992f1 /src
parentbe7a9066d9c45ee69218b294f27501796782b3a8 (diff)
glsl: add missing check for samplers in set_opaque_binding()
Like images, this prevents out-of-bound access when the explicit binding layout qualifier is used with an array which contains too much samplers. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl/link_uniform_initializers.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/compiler/glsl/link_uniform_initializers.cpp b/src/compiler/glsl/link_uniform_initializers.cpp
index 8911c3de62a..79a6c75aaa8 100644
--- a/src/compiler/glsl/link_uniform_initializers.cpp
+++ b/src/compiler/glsl/link_uniform_initializers.cpp
@@ -135,6 +135,8 @@ set_opaque_binding(void *mem_ctx, gl_shader_program *prog,
if (storage->type->is_sampler() && storage->opaque[sh].active) {
for (unsigned i = 0; i < elements; i++) {
const unsigned index = storage->opaque[sh].index + i;
+ if (index >= ARRAY_SIZE(shader->Program->SamplerUnits))
+ break;
shader->Program->SamplerUnits[index] =
storage->storage[i].i;
}