egl/wayland: fix oob buffer access during buffer_fds clean up

After iterating through the number of planes in the above for
loop i is more than the number of planes which corresponds to
the size of the buffer_fds array.

Fixes: 967b9ad084 ("egl/wayland: for prime, allocate linear_copy from display GPU VRAM")
Signed-off-by: David Redondo <kde@david-redondo.de>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22496>
This commit is contained in:
David Redondo
2023-04-14 11:47:43 +02:00
committed by Marge Bot
parent 0d7912d239
commit eb7e906886
+2 -2
View File
@@ -1121,10 +1121,10 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
&strides[0],
&offsets[0],
dri2_surf->back);
do {
for (i = 0; i < num_planes; ++i) {
if (buffer_fds[i] != -1)
close(buffer_fds[i]);
} while (--i >= 0);
}
dri2_dpy->image->destroyImage(linear_copy_display_gpu_image);
}
}