Mesa (master): egl: Unhide functionality in _eglInitSurface()

Brian Paul brianp at kemper.freedesktop.org
Fri Feb 7 15:26:49 UTC 2014


Module: Mesa
Branch: master
Commit: 498d10e230663f8604d00608cae6324f779c9cdd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=498d10e230663f8604d00608cae6324f779c9cdd

Author: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Date:   Fri Feb  7 14:44:05 2014 +0200

egl: Unhide functionality in _eglInitSurface()

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

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/egl/main/eglsurface.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index c5ea224..1dca3e0 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -314,7 +314,9 @@ _eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
       return EGL_FALSE;
    }
 
-   _eglInitResource(&surf->Resource, sizeof(*surf), dpy);
+
+   memset(surf, 0, sizeof(_EGLSurface));
+   _eglInitResource(&surf->Resource, sizeof(_EGLResource), dpy);
    surf->Type = type;
    surf->Config = conf;
 




More information about the mesa-commit mailing list