Mesa (master): egl: Check config's surface types in eglCreate*Surface()
Chad Versace
chadversary at kemper.freedesktop.org
Tue Dec 20 19:53:44 UTC 2016
Module: Mesa
Branch: master
Commit: fbb4af96c6b6be08ed93e8d5a704b9f7002642f8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fbb4af96c6b6be08ed93e8d5a704b9f7002642f8
Author: Chad Versace <chadversary at chromium.org>
Date: Fri Dec 16 11:00:13 2016 -0800
egl: Check config's surface types in eglCreate*Surface()
If the provided EGLConfig does not support the requested surface type,
then emit EGL_BAD_MATCH.
Fixes dEQP-EGL.functional.negative_api.create_pbuffer_surface
on GBM.
Cc: "13.0" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
---
src/egl/main/eglapi.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index a349992..cab05c2 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -875,6 +875,9 @@ _eglCreateWindowSurfaceCommon(_EGLDisplay *disp, EGLConfig config,
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
+ if ((conf->SurfaceType & EGL_WINDOW_BIT) == 0)
+ RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_NO_SURFACE);
+
surf = drv->API.CreateWindowSurface(drv, disp, conf, native_window,
attrib_list);
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
@@ -993,6 +996,10 @@ _eglCreatePixmapSurfaceCommon(_EGLDisplay *disp, EGLConfig config,
#endif
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
+
+ if ((conf->SurfaceType & EGL_PIXMAP_BIT) == 0)
+ RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_NO_SURFACE);
+
surf = drv->API.CreatePixmapSurface(drv, disp, conf, native_pixmap,
attrib_list);
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
@@ -1063,6 +1070,9 @@ eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_NO_SURFACE);
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
+ if ((conf->SurfaceType & EGL_PBUFFER_BIT) == 0)
+ RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_NO_SURFACE);
+
surf = drv->API.CreatePbufferSurface(drv, disp, conf, attrib_list);
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
More information about the mesa-commit
mailing list