[Mesa-dev] [PATCH 4/5] egl: Unhide functionality in _eglInitSync()

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Fri Feb 14 05:23:58 PST 2014


_eglInitResource() was used to memset entire _EGLSync by
writing more than size of pointed target. This does work
as long as Resource is the first element in _EGLSync,
this patch fixes such dependency.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 src/egl/main/eglsync.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/egl/main/eglsync.c b/src/egl/main/eglsync.c
index 9d0067c..ba8a32f 100644
--- a/src/egl/main/eglsync.c
+++ b/src/egl/main/eglsync.c
@@ -75,7 +75,8 @@ _eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type,
        !(type == EGL_SYNC_FENCE_KHR && dpy->Extensions.KHR_fence_sync))
       return _eglError(EGL_BAD_ATTRIBUTE, "eglCreateSyncKHR");
 
-   _eglInitResource(&sync->Resource, sizeof(*sync), dpy);
+   memset(sync, 0, sizeof(_EGLSync));
+   _eglInitResource(&sync->Resource, sizeof(_EGLResource), dpy);
    sync->Type = type;
    sync->SyncStatus = EGL_UNSIGNALED_KHR;
    sync->SyncCondition = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR;
-- 
1.8.1.2



More information about the mesa-dev mailing list