[Mesa-dev] [PATCH 1/3] glsl: add missing check for samplers in set_opaque_binding()
Samuel Pitoiset
samuel.pitoiset at gmail.com
Thu May 11 10:31:26 UTC 2017
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 <samuel.pitoiset at gmail.com>
---
src/compiler/glsl/link_uniform_initializers.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/compiler/glsl/link_uniform_initializers.cpp b/src/compiler/glsl/link_uniform_initializers.cpp
index 8911c3de62..79a6c75aaa 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;
}
--
2.12.2
More information about the mesa-dev
mailing list