summaryrefslogtreecommitdiff
path: root/src/lib/eo
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-04-17 19:39:42 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-04-18 15:34:29 +0900
commitd6d4c3c25b932ff5fac8c6d0834c515cfa9d9c3b (patch)
tree5247f8a28b9355126905b0d2644387796062728d /src/lib/eo
parent3e494a0a21831298d48edcfc14cbd8e49d40bbfa (diff)
eo: Fix crash in case of API misuse
If efl_object_override() is called with a function that does not exist in the original class, it may lead to a crash on indexing an non-existing array in the vtable. This is really just a safety check, as the usage was wrong: * You are only allowed to override functions that are defined in the * class or any of its interfaces (that is, efl_isa returning true).
Diffstat (limited to 'src/lib/eo')
-rw-r--r--src/lib/eo/eo.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index ebcf041744..988487840e 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -232,7 +232,10 @@ _vtable_func_set(Eo_Vtable *vtable, const _Efl_Class *klass, Efl_Object_Op op, E
232{ 232{
233 op_type_funcs *fsrc; 233 op_type_funcs *fsrc;
234 size_t idx1 = DICH_CHAIN1(op); 234 size_t idx1 = DICH_CHAIN1(op);
235 Dich_Chain1 *chain1 = &vtable->chain[idx1]; 235 Dich_Chain1 *chain1;
236
237 EINA_SAFETY_ON_FALSE_RETURN_VAL(idx1 < vtable->size, EINA_FALSE);
238 chain1 = &vtable->chain[idx1];
236 _vtable_chain_write_prepare(chain1); 239 _vtable_chain_write_prepare(chain1);
237 fsrc = &chain1->chain2->funcs[DICH_CHAIN_LAST(op)]; 240 fsrc = &chain1->chain2->funcs[DICH_CHAIN_LAST(op)];
238 if (!allow_same_override && (fsrc->src == klass)) 241 if (!allow_same_override && (fsrc->src == klass))