[Mesa-dev] [PATCH] egl_dri2: NULL check for EGLNativeWindowType

Brian Paul brianp at vmware.com
Mon Jul 16 12:05:35 PDT 2012


On 07/10/2012 08:13 PM, Elvis Lee wrote:
> Some application calls eglCreateWindowSurface with
> EGLNativeWindowType parameter having zero value. It causes SEGV
> and disturbs error handling like EGL_NO_SURFACE.
>
> Signed-off-by: Elvis Lee<kwangwoong.lee at lge.com>
> ---
>   src/egl/drivers/dri2/platform_drm.c |    2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
> index 54067ff..9aafb52 100644
> --- a/src/egl/drivers/dri2/platform_drm.c
> +++ b/src/egl/drivers/dri2/platform_drm.c
> @@ -108,6 +108,8 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
>
>      switch (type) {
>      case EGL_WINDOW_BIT:
> +      if (!window)
> +         return NULL;
>         surf = gbm_dri_surface((struct gbm_surface *) window);
>         dri2_surf->gbm_surf = surf;
>         dri2_surf->base.Width =  surf->base.width;

Looks OK to me.  I'll commit/push later.

-Brian



More information about the mesa-dev mailing list