egl: Unhide functionality in _eglInitSurface()
authorJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Fri, 7 Feb 2014 12:44:05 +0000 (14:44 +0200)
committerBrian Paul <brianp@vmware.com>
Fri, 7 Feb 2014 15:14:05 +0000 (08:14 -0700)
_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@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/egl/main/eglsurface.c

index c5ea2245b3d41e7df2b52735f5cf48535c8fcc74..1dca3e06876a03b37e5ed844ce319e939642a344 100644 (file)
@@ -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;