egl/wayland: Don't try to access modifiers u_vector as dynarray
The modifiers are u_vectors, but the code was trying to access them
as dynarrays. This resulted in a wrong number of modifiers, which then
later on would also lead to invalid reads used as modifiers.
In the case of the iris driver, a wrongly read number of modifiers > 0
would also trigger an error message.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6643
Fixes: b5848b2dac
("egl/wayland: use surface dma-buf feedback to allocate surface buffers")
Reviewed-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17180>
This commit is contained in:

committed by
Marge Bot

parent
8ce7faab47
commit
f50fe9b0b6
@@ -937,9 +937,8 @@ create_dri_image_from_dmabuf_feedback(struct dri2_egl_surface *dri2_surf,
|
||||
/* Ignore tranches that do not contain dri2_surf->format */
|
||||
if (!BITSET_TEST(tranche->formats.formats_bitmap, visual_idx))
|
||||
continue;
|
||||
modifiers = util_dynarray_begin(&tranche->formats.modifiers[visual_idx]);
|
||||
num_modifiers = util_dynarray_num_elements(&tranche->formats.modifiers[visual_idx],
|
||||
uint64_t);
|
||||
modifiers = u_vector_tail(&tranche->formats.modifiers[visual_idx]);
|
||||
num_modifiers = u_vector_length(&tranche->formats.modifiers[visual_idx]);
|
||||
|
||||
/* For the purposes of this function, an INVALID modifier on
|
||||
* its own means the modifiers aren't supported. */
|
||||
|
Reference in New Issue
Block a user