We have customers using NULL as a way to test the robustness of
the API.  Without this check, EGL will segfault trying to
dereference dri2_surf->wl_win->private because wl_win is
NULL.

This fix adds a check and sets EGL_BAD_NATIVE_WINDOW
---
 src/egl/drivers/dri2/platform_wayland.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index 537d26e..66f51e9 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -130,6 +130,13 @@ dri2_wl_create_surface(_EGLDriver *drv, _EGLDisplay *disp, 
EGLint type,
 
    (void) drv;
 
+   if (NULL == window)
+   {
+      _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface");
+      return NULL;
+   }
+
+
    dri2_surf = malloc(sizeof *dri2_surf);
    if (!dri2_surf) {
       _eglError(EGL_BAD_ALLOC, "dri2_create_surface");
-- 
1.9.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to