egl: move Null check to eglGetSyncAttribKHR to prevent Segfault
Null-check on "*value" is currently done in _eglGetSyncAttrib, which is after eglGetSyncAttribKHR dereferences it. Move the check a layer up (in the beginning of eglGetSyncAttribKHR) to avoid segfaults. Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> [Emil Velikov: tweak commit message, add stable tag] Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
parent
b697400a97
commit
d1e1563bb6
|
@ -1555,8 +1555,14 @@ eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *valu
|
||||||
static EGLBoolean EGLAPIENTRY
|
static EGLBoolean EGLAPIENTRY
|
||||||
eglGetSyncAttribKHR(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLint *value)
|
eglGetSyncAttribKHR(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLint *value)
|
||||||
{
|
{
|
||||||
EGLAttrib attrib = *value;
|
EGLAttrib attrib;
|
||||||
EGLBoolean result = eglGetSyncAttrib(dpy, sync, attribute, &attrib);
|
EGLBoolean result;
|
||||||
|
|
||||||
|
if (!value)
|
||||||
|
RETURN_EGL_ERROR(NULL, EGL_BAD_PARAMETER, EGL_FALSE);
|
||||||
|
|
||||||
|
attrib = *value;
|
||||||
|
result = eglGetSyncAttrib(dpy, sync, attribute, &attrib);
|
||||||
|
|
||||||
/* The EGL_KHR_fence_sync spec says this about eglGetSyncAttribKHR:
|
/* The EGL_KHR_fence_sync spec says this about eglGetSyncAttribKHR:
|
||||||
*
|
*
|
||||||
|
|
|
@ -144,9 +144,6 @@ EGLBoolean
|
||||||
_eglGetSyncAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
|
_eglGetSyncAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
|
||||||
EGLint attribute, EGLAttrib *value)
|
EGLint attribute, EGLAttrib *value)
|
||||||
{
|
{
|
||||||
if (!value)
|
|
||||||
return _eglError(EGL_BAD_PARAMETER, "eglGetSyncAttribKHR");
|
|
||||||
|
|
||||||
switch (attribute) {
|
switch (attribute) {
|
||||||
case EGL_SYNC_TYPE_KHR:
|
case EGL_SYNC_TYPE_KHR:
|
||||||
*value = sync->Type;
|
*value = sync->Type;
|
||||||
|
|
Loading…
Reference in New Issue