[Mesa-dev] [PATCH] egl/dri: don't crash when createImageFromRenderbuffer2 is NULL

Nicolai Hähnle nhaehnle at gmail.com
Wed Oct 11 21:28:49 UTC 2017


On 10.10.2017 19:52, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> 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")
> Cc: Nicolai Hähnle <nhaehnle at gmail.com>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>

Thanks!

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>


> ---
>   src/egl/drivers/dri2/egl_dri2.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index 171858bbcd9..d65ced0c22f 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -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(
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list