[Mesa-dev] [PATCH 2/2] i965: Cancel make_surface() if the surface format is unsupported

Chris Wilson chris at chris-wilson.co.uk
Mon Jul 31 09:22:45 UTC 2017


Return early if translate_tex_format() makes the incoming format onto an
unsupported type, otherwise we try to access beyond the end of the isl
formats array.
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index daa49f9922..edf30fc14d 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -556,6 +556,9 @@ make_surface(struct brw_context *brw, GLenum target, mesa_format format,
       .tiling_flags = tiling_flags,
    };
 
+   if (init_info.format == ISL_FORMAT_UNSUPPORTED)
+      goto fail;
+
    if (!isl_surf_init_s(&brw->isl_dev, &mt->surf, &init_info))
       goto fail;
 
-- 
2.13.3



More information about the mesa-dev mailing list