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

Elvis Lee kwangwoong.lee at lge.com
Tue Jul 10 19:13:51 PDT 2012


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;
-- 
1.7.9.5



More information about the mesa-dev mailing list