[Mesa-dev] [PATCH 4/4] egl/x11: handle when invalid drawable is passed in create_surface

Marek Olšák maraeo at gmail.com
Sat Jun 27 01:44:12 PDT 2015


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Fri, Jun 26, 2015 at 2:04 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> 0 is not used as a valid drawable id, as such there is no point in
> attempting to query it's geometry. Just bail out early and provide the
> more meaningful EGL_BAD_NATIVE_WINDOW to the user.
>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>  src/egl/drivers/dri2/platform_x11.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
> index 56c1428..9114074 100644
> --- a/src/egl/drivers/dri2/platform_x11.c
> +++ b/src/egl/drivers/dri2/platform_x11.c
> @@ -235,6 +235,10 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
>                         dri2_surf->drawable, screen->root,
>                         dri2_surf->base.Width, dri2_surf->base.Height);
>     } else {
> +      if (!drawable) {
> +         _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface");
> +         goto cleanup_surf;
> +      }
>        dri2_surf->drawable = drawable;
>     }
>
> --
> 2.4.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list