diff options
author | Icecream95 <ixn@disroot.org> | 2022-07-10 20:52:54 +1200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-07-23 00:56:10 +0000 |
commit | 379ae6d82383e0c70797d96de4e6966c972618fc (patch) | |
tree | f03ec554a454ec85f998c1905a3562c4b006abc6 /src/panfrost/util | |
parent | fe613a8de95a95a3c44bd47c80316830ab10945e (diff) | |
download | mesa-379ae6d82383e0c70797d96de4e6966c972618fc.tar.gz mesa-379ae6d82383e0c70797d96de4e6966c972618fc.tar.bz2 mesa-379ae6d82383e0c70797d96de4e6966c972618fc.zip |
panfrost: Emit the correct number of attributes
create_vertex_elements_state is sometimes called with a too large
num_elements argument, for example with util_blitter, which causes a
buffer overflow.
There is no documentation to forbid this practice, so don't rely on
so->num_elements being correct and instead use the vertex shader
attribute count, which matches the value used to allocate the
descriptors.
Use attributes_read_count rather than attribute_count because the
latter also includes images and PAN_VERTEX_ID/PAN_INSTANCE_ID.
Fixes: 76de3e691c6 ("panfrost: Merge attribute packing routines")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17447>
Diffstat (limited to 'src/panfrost/util')
-rw-r--r-- | src/panfrost/util/pan_ir.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/panfrost/util/pan_ir.h b/src/panfrost/util/pan_ir.h index 820a6e61455..e3fb48e16d4 100644 --- a/src/panfrost/util/pan_ir.h +++ b/src/panfrost/util/pan_ir.h @@ -354,6 +354,7 @@ struct pan_shader_info { unsigned sampler_count; unsigned texture_count; unsigned ubo_count; + unsigned attributes_read_count; unsigned attribute_count; unsigned attributes_read; |