Mesa (main): egl/wayland: do not try to access memory if allocation failed

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Nov 26 20:00:50 UTC 2021


Module: Mesa
Branch: main
Commit: 6c37784400f9f170c3c39b9c2e5fd58308c4872a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6c37784400f9f170c3c39b9c2e5fd58308c4872a

Author: Leandro Ribeiro <leandro.ribeiro at collabora.com>
Date:   Mon Jun 28 21:06:17 2021 -0300

egl/wayland: do not try to access memory if allocation failed

Signed-off-by: Leandro Ribeiro <leandro.ribeiro at collabora.com>
Reviewed-by: Daniel Stone <daniels at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

---

 src/egl/drivers/dri2/platform_wayland.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 3fd8d8465c2..2796f45db57 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1339,7 +1339,8 @@ dmabuf_handle_modifier(void *data, struct zwp_linux_dmabuf_v1 *dmabuf,
    BITSET_SET(dri2_dpy->formats, visual_idx);
 
    mod = u_vector_add(&dri2_dpy->wl_modifiers[visual_idx]);
-   *mod = combine_u32_into_u64(modifier_hi, modifier_lo);
+   if (mod)
+      *mod = combine_u32_into_u64(modifier_hi, modifier_lo);
 }
 
 static const struct zwp_linux_dmabuf_v1_listener dmabuf_listener = {



More information about the mesa-commit mailing list