egl_dri2: NULL check for EGLNativeWindowType
authorElvis Lee <kwangwoong.lee@lge.com>
Wed, 11 Jul 2012 02:13:51 +0000 (11:13 +0900)
committerBrian Paul <brianp@vmware.com>
Mon, 16 Jul 2012 22:03:31 +0000 (16:03 -0600)
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@lge.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
src/egl/drivers/dri2/platform_drm.c

index 54067ff..9aafb52 100644 (file)
@@ -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;