Mesa (master): egl/wayland: check for invalid format index

Eric Engeström eric_engestrom at kemper.freedesktop.org
Fri Feb 16 13:15:56 UTC 2018


Module: Mesa
Branch: master
Commit: 65dda6c9ec1d80ee36c8bff157f49d97baffebce
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=65dda6c9ec1d80ee36c8bff157f49d97baffebce

Author: Eric Engestrom <eric.engestrom at imgtec.com>
Date:   Thu Feb 15 11:10:22 2018 +0000

egl/wayland: check for invalid format index

v2: just tell the compiler to assume the format will always be found, as
it comes from the table itself to begin with. (DanielS)

CID: 1429516
Fixes: d32b23f3830099a328b91 "egl/wayland: Add bpp to visual map"
Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
Reviewed-by: Daniel Stone <daniels at collabora.com>

---

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

diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 5b8bec901b..877f7933b9 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1452,6 +1452,8 @@ dri2_wl_swrast_get_stride_for_format(int format, int w)
 {
    int visual_idx = dri2_wl_visual_idx_from_shm_format(format);
 
+   assume(visual_idx != -1);
+
    return w * (dri2_wl_visuals[visual_idx].bpp / 8);
 }
 




More information about the mesa-commit mailing list