lavapipe: fix incorrect sv[] array size
authorBrian Paul <brianp@vmware.com>
Wed, 15 Jun 2022 21:41:10 +0000 (15:41 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 14 Jul 2022 19:16:07 +0000 (19:16 +0000)
commit29ec6372cc13958691add84360ca7ac447b4c409
treeac5a3326ff22bfcb3791a785bed06b78b18d5b43
parenta0ea45fb687a44db5bee89f997c886ce6ac5197f
lavapipe: fix incorrect sv[] array size

The sampler views array needs to be dimensioned by
PIPE_MAX_SHADER_SAMPLER_VIEWS, not PIPE_MAX_SAMPLERS.

This fixes out-of-bounds array writes when using more than 32
textures in a shader.

Also add some assertions to check array indexing elsewhere.
And change loop limits to be based on ARRAY_SIZE().

Signed-off-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17062>
src/gallium/frontends/lavapipe/lvp_execute.c