summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2017-06-29 00:12:15 +0100
committerEmil Velikov <[email protected]>2017-07-12 15:43:12 +0100
commit4d8191fd000071328b97bde5fc31ab1c39238d27 (patch)
treee08e89baac396f86111f2f7409c2c1ef17594451 /src
parentcd859452e900e588ad8f7c067d2378fad7fc9c93 (diff)
egl: check for extensions' presence during attr parsing
If the respective extension is not supported, one should return EGL_BAD_PARAMETER as mentioned in earlier commits. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/egl/main/eglimage.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c
index b361a2d0242..a96075fe558 100644
--- a/src/egl/main/eglimage.c
+++ b/src/egl/main/eglimage.c
@@ -39,16 +39,23 @@ _eglParseKHRImageAttribs(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
EGLint attr, EGLint val)
{
switch (attr) {
- /* EGL_KHR_image_base */
case EGL_IMAGE_PRESERVED_KHR:
+ if (!dpy->Extensions.KHR_image_base)
+ return EGL_BAD_PARAMETER;
+
attrs->ImagePreserved = val;
break;
- /* EGL_KHR_gl_image */
case EGL_GL_TEXTURE_LEVEL_KHR:
+ if (!dpy->Extensions.KHR_gl_texture_2D_image)
+ return EGL_BAD_PARAMETER;
+
attrs->GLTextureLevel = val;
break;
case EGL_GL_TEXTURE_ZOFFSET_KHR:
+ if (!dpy->Extensions.KHR_gl_texture_3D_image)
+ return EGL_BAD_PARAMETER;
+
attrs->GLTextureZOffset = val;
break;
default:
@@ -62,8 +69,10 @@ static EGLint
_eglParseMESADrmImageAttribs(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
EGLint attr, EGLint val)
{
+ if (!dpy->Extensions.MESA_drm_image)
+ return EGL_BAD_PARAMETER;
+
switch (attr) {
- /* EGL_MESA_drm_image */
case EGL_WIDTH:
attrs->Width = val;
break;
@@ -90,8 +99,10 @@ static EGLint
_eglParseWLBindWaylandDisplayAttribs(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
EGLint attr, EGLint val)
{
+ if (!dpy->Extensions.WL_bind_wayland_display)
+ return EGL_BAD_PARAMETER;
+
switch (attr) {
- /* EGL_WL_bind_wayland_display */
case EGL_WAYLAND_PLANE_WL:
attrs->PlaneWL = val;
break;
@@ -106,6 +117,9 @@ static EGLint
_eglParseEXTImageDmaBufImportAttribs(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
EGLint attr, EGLint val)
{
+ if (!dpy->Extensions.EXT_image_dma_buf_import)
+ return EGL_BAD_PARAMETER;
+
switch (attr) {
case EGL_WIDTH:
attrs->Width = val;