egl/wayland: check for invalid format index
authorEric Engestrom <eric.engestrom@imgtec.com>
Thu, 15 Feb 2018 11:10:22 +0000 (11:10 +0000)
committerEric Engestrom <eric.engestrom@imgtec.com>
Fri, 16 Feb 2018 13:14:29 +0000 (13:14 +0000)
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@imgtec.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
src/egl/drivers/dri2/platform_wayland.c

index 5b8bec901b076799ee6e762ac5c31b178acfe41d..877f7933b9a13d2c57d6a4a432126883b2965cc0 100644 (file)
@@ -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);
 }