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

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


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

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

egl: Unhide functionality in _eglInitContext()

_eglInitResource() was used to memset entire _EGLContext by
writing more than size of pointed target. This does work
as long as Resource is the first element in _EGLContext,
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/eglcontext.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index 79a92c7..99d1c3e 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -366,7 +366,8 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, _EGLConfig *conf,
       return EGL_FALSE;
    }
 
-   _eglInitResource(&ctx->Resource, sizeof(*ctx), dpy);
+   memset(ctx, 0, sizeof(_EGLContext));
+   _eglInitResource(&ctx->Resource, sizeof(_EGLResource), dpy);
    ctx->ClientAPI = api;
    ctx->Config = conf;
    ctx->WindowRenderBuffer = EGL_NONE;




More information about the mesa-commit mailing list