mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 11:00:11 +01:00
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 <samuel.pitoiset@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
parent
be7a9066d9
commit
a29810e27c
1 changed files with 2 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue