egl: check for NULL value like eglGetSyncAttribKHR does
authorTapani Pälli <tapani.palli@intel.com>
Mon, 10 Jun 2019 10:06:05 +0000 (13:06 +0300)
committerTapani Pälli <tapani.palli@intel.com>
Thu, 19 Sep 2019 06:39:33 +0000 (06:39 +0000)
Commit d1e1563bb63 added a NULL check for eglGetSyncAttribKHR
but eglGetSyncAttrib does not do this. Patch adds same check to
happen with eglGetSyncAttrib.

Fixes crashes in (when exposing EGL 1.5):
   dEQP-EGL.functional.fence_sync.invalid.get_invalid_value

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Cc: mesa-stable@lists.freedesktop.org
src/egl/main/eglapi.c

index bed4ddced68abd63d94bd8fef2f3ca84b4cbf369..51557be0864a43f3f4621fc04e130e614caa4c0c 100644 (file)
@@ -2115,6 +2115,10 @@ eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *valu
    _EGLDisplay *disp = _eglLockDisplay(dpy);
    _EGLSync *s = _eglLookupSync(sync, disp);
    _EGL_FUNC_START(disp, EGL_OBJECT_SYNC_KHR, s, EGL_FALSE);
+
+   if (!value)
+      RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);
+
    return _eglGetSyncAttribCommon(disp, s, attribute, value);
 }