aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/eo
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-26 17:00:27 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-26 17:58:07 +0900
commit0ae529ac196a5b212e2b7386aef9978c4cfa095c (patch)
treee595a510127504be457b5a2fa8fa02504eb37cc1 /src/lib/eo
parentecore_ipc: Unregister log domain on shutdown (diff)
downloadefl-0ae529ac196a5b212e2b7386aef9978c4cfa095c.tar.gz
eo: Fix crashes with call cache after init cycle
It's not enough to check the init generation count, if the cache data is not reset properly. This patch adds safety in two ways: 1. Actually reset the op call cache when we detect a new generation 2. Verify that we don't return NULL function pointer The 1st point is absolutely necessary, 2nd is optional (extra cost of one if()). @fix
Diffstat (limited to 'src/lib/eo')
-rw-r--r--src/lib/eo/Eo.h1
-rw-r--r--src/lib/eo/eo.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index fe5a550316..ea924ab927 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -1231,6 +1231,7 @@ typedef struct _Efl_Object_Call_Cache
// hits.
#define EFL_FUNC_COMMON_OP_END(Obj, Name, DefRet) \
__##Name##_op_create: \
+ if (EINA_UNLIKELY(___cache.op != EFL_NOOP)) memset(&___cache, 0, sizeof(___cache)); \
___cache.op = _efl_object_op_api_id_get(EFL_FUNC_COMMON_OP_FUNC(Name), Obj, #Name, __FILE__, __LINE__); \
if (___cache.op == EFL_NOOP) return DefRet; \
___cache.generation = _efl_object_init_generation; \
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index b4bd760b44..f7358db12f 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -498,6 +498,7 @@ ok_klass_back:
call->func = func->func;
if (is_obj)
call->data = (char *)obj + cache->off[i].off;
+ if (EINA_UNLIKELY(!call->func)) goto err_cache_op;
return EINA_TRUE;
}
}