cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=ffb518fcdd7982290cd5e8d1d1b64a6bb4825bfb

commit ffb518fcdd7982290cd5e8d1d1b64a6bb4825bfb
Author: Jean Guyomarc'h <[email protected]>
Date:   Mon Sep 22 14:20:31 2014 +0200

    evas: Gl_Cocoa - fix early segfault caused by unloaded symbols
    
    Summary:
    evas_gl_symbols() (introduced in commit 9a9d78d) was not dlsym()ed
    which led to unloaded symbols, so NULL function pointers which were happily
    dereferenced, leading to an early segfault, and therefore to a broken 
engine.
    
    @fix
    
    Reviewers: cedric, raoulh
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D1440
    
    Signed-off-by: Cedric BAIL <[email protected]>
---
 src/modules/evas/engines/gl_cocoa/evas_engine.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/modules/evas/engines/gl_cocoa/evas_engine.c 
b/src/modules/evas/engines/gl_cocoa/evas_engine.c
index 1a1eb9b..76bc6d5 100644
--- a/src/modules/evas/engines/gl_cocoa/evas_engine.c
+++ b/src/modules/evas/engines/gl_cocoa/evas_engine.c
@@ -13,6 +13,8 @@ typedef struct _Render_Engine Render_Engine;
 typedef struct _Render_Engine_GL_Surface    Render_Engine_GL_Surface;
 typedef struct _Render_Engine_GL_Context    Render_Engine_GL_Context;
 
+Evas_Gl_Symbols glsym_evas_gl_symbols = NULL;
+
 struct _Render_Engine
 {
    Evas_GL_Cocoa_Window *win;
@@ -1337,6 +1339,12 @@ eng_image_load_error_get(void *data EINA_UNUSED, void 
*image)
    return im->im->cache_entry.load_error;
 }
 
+static void *
+_dlsym(const char *sym)
+{
+   return dlsym(RTLD_DEFAULT, sym);
+}
+
 static int
 module_open(Evas_Module *em)
 {
@@ -1422,6 +1430,12 @@ module_open(Evas_Module *em)
 
    ORD(image_load_error_get);    
 
+#define LINK2GENERIC(sym) \
+   glsym_##sym = dlsym(RTLD_DEFAULT, #sym);
+
+   LINK2GENERIC(evas_gl_symbols);
+   glsym_evas_gl_symbols(_dlsym);
+
    /* now advertise out own api */
    em->functions = (void *)(&func);
    return 1;

-- 


Reply via email to