diff options
author | Sinclair Yeh <sinclair.yeh@intel.com> | 2014-06-03 14:00:13 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2014-06-06 18:11:30 -0700 |
commit | f4aca6868a14882fcc8a2b30205fc0d3eff0e90f (patch) | |
tree | 9e2bb2b6917b050b562eb5010ed19817b8462b52 /src/egl | |
parent | 5ab9a9c0ccff8218e9625f43a25535cf7d1d8ae0 (diff) |
egl: Check for NULL native_window in eglCreateWindowSurface
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
v2: Incorporated feedback from idr - moved the check to a higher level
function.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 91ff0d4c6510dc38f279c586ced17fba917873e7)
Diffstat (limited to 'src/egl')
-rw-r--r-- | src/egl/main/eglapi.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index b946d81b783..25453f47c82 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; |