[Mesa-stable] [PATCH] Check for NULL native_window into eglCreateWindowSurface()
Sinclair Yeh
sinclair.yeh at intel.com
Tue Jun 3 14:00:13 PDT 2014
v2:
Incorporated feedback from idr - moved the check to a higher level
function.
v1:
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
Cc: "10.1 10.2" <mesa-stable at lists.freedesktop.org>
---
src/egl/main/eglapi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 7846814..096c3d8 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -571,6 +571,10 @@ _eglCreateWindowSurfaceCommon(_EGLDisplay *disp, EGLConfig config,
EGLSurface ret;
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
+
+ if (native_window == NULL)
+ RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
+
surf = drv->API.CreateWindowSurface(drv, disp, conf, native_window,
attrib_list);
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
--
1.9.1
More information about the mesa-stable
mailing list