diff options
author | Dave Airlie <[email protected]> | 2016-05-23 12:49:25 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2016-05-31 10:41:44 +1000 |
commit | f87352d76966b6e4b0ab5fa9129ccd1ade0c2e7a (patch) | |
tree | f14f3df19106ce11f0d3d75003e1525143fc9092 /src/compiler/glsl | |
parent | 4b1a167a2bce936beabd03ffc313a63d8deeed09 (diff) |
glsl/images: bounds check image unit assignment
The CTS test:
GL45-CTS.multi_bind.dispatch_bind_image_textures
binds 192 image uniforms, we reject this later,
but not until after we trash the contents of the
struct gl_shader.
Error now reads:
Too many compute shader image uniforms (192 > 16)
instead of
Too many compute shader image uniforms (2745344416 > 16)
Reviewed-by: Ilia Mirkin <[email protected]>
Cc: "12.0" <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r-- | src/compiler/glsl/link_uniform_initializers.cpp | 2 |
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 c6346d573ab..bf6d394ea89 100644 --- a/src/compiler/glsl/link_uniform_initializers.cpp +++ b/src/compiler/glsl/link_uniform_initializers.cpp @@ -145,6 +145,8 @@ set_opaque_binding(void *mem_ctx, gl_shader_program *prog, storage->opaque[sh].active) { for (unsigned i = 0; i < elements; i++) { const unsigned index = storage->opaque[sh].index + i; + if (index >= ARRAY_SIZE(shader->ImageUnits)) + break; shader->ImageUnits[index] = storage->storage[i].i; } } |