mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-02 09:01:39 -05:00
shm: Relax shm_pool_create_buffer() validity check
shm_pool_create_buffer() can raise a false WL_SHM_ERROR_INVALID_STRIDE error under some circumstances because of integer division. Fix this by using a strict comparison operator instead of lower or equal. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Demi Marie Obenour <demi@invisiblethingslab.com> Reviewed-by: Simon Ser <contact@emersion.fr> Reviewed-by: Jonas Ådahl <jadahl@gmail.com> Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/235
This commit is contained in:
parent
7ef305d073
commit
616b4ae618
1 changed files with 1 additions and 1 deletions
|
|
@ -213,7 +213,7 @@ shm_pool_create_buffer(struct wl_client *client, struct wl_resource *resource,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset < 0 || width <= 0 || height <= 0 || stride < width ||
|
if (offset < 0 || width <= 0 || height <= 0 || stride < width ||
|
||||||
INT32_MAX / stride <= height ||
|
INT32_MAX / stride < height ||
|
||||||
offset > pool->size - stride * height) {
|
offset > pool->size - stride * height) {
|
||||||
wl_resource_post_error(resource,
|
wl_resource_post_error(resource,
|
||||||
WL_SHM_ERROR_INVALID_STRIDE,
|
WL_SHM_ERROR_INVALID_STRIDE,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue