[Mesa-dev] [PATCH 1/5] egl: don't crash if app tries to use unsupported dma-buf extension

Rob Clark robdclark at gmail.com
Sun Sep 21 10:46:26 PDT 2014


From: Rob Clark <robclark at freedesktop.org>

If app tries to use EGL_EXT_image_dma_buf_import without checking that
it is supported, we should at least be a bit kinder than segfaulting.

Signed-off-by: Rob Clark <robclark at freedesktop.org>
---
Not 100% sure which error we should report.. doing *anything* other than
segfault seems like an improvement, but if someone could recommend a better
error to report I'll change it.

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

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 20a7243..eb9acff 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1712,6 +1712,11 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
       return NULL;
    }
 
+   if (!dri2_dpy->image->createImageFromDmaBufs) {
+      _eglError(EGL_BAD_PARAMETER, "not supported");
+      return NULL;
+   }
+
    err = _eglParseImageAttribList(&attrs, disp, attr_list);
    if (err != EGL_SUCCESS) {
       _eglError(err, "bad attribute");
-- 
1.9.3



More information about the mesa-dev mailing list