egl/dri: don't crash when createImageFromRenderbuffer2 is NULL
authorEmil Velikov <emil.velikov@collabora.com>
Tue, 10 Oct 2017 17:50:13 +0000 (18:50 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 13 Oct 2017 11:56:12 +0000 (12:56 +0100)
The __DRI_IMAGE version can be 17 or over, while the function pointer is
NULL. Guard for that instead of crashing.

Fixes: bad24395d91 ("egl/dri: use createImageFromRenderbuffer2 when
available")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/egl/drivers/dri2/egl_dri2.c

index 5334384d2f560303e62004e2b3252078ab9c3a3f..d5cdf32afa6d8d5fb24ddf9b8400a48f0fd6e278 100644 (file)
@@ -1890,7 +1890,8 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx,
       return EGL_NO_IMAGE_KHR;
    }
 
-   if (dri2_dpy->image->base.version >= 17) {
+   if (dri2_dpy->image->base.version >= 17 &&
+       dri2_dpy->image->createImageFromRenderbuffer2) {
       unsigned error = ~0;
 
       dri_image = dri2_dpy->image->createImageFromRenderbuffer2(