Hi,

What happens if a group has 2 name statements("double named")?
edje will fail to free the groups cache while shuting down due
the collection directory entry hash having two entries with
different names but pointing to the same object - the second try
to free the part mem pool will fail - since it was freed before -
and issue an abort.

Attached goes a patch to fix the issue.

Regards...

-- 
Leandro Dorileo
ProFUSION embedded systems
http://profusion.mobi
>From ed80571de39aab5ce25ae0ce3b2a888d04e9bd05 Mon Sep 17 00:00:00 2001
From: Leandro Dorileo <dori...@profusion.mobi>
Date: Tue, 20 Nov 2012 15:33:00 -0200
Subject: [PATCH] Edje: invalidate double named group

What happens if a group has 2 name statements("double named")?
edje will fail to free the groups cache while shuting down due
the collection directory entry hash having two entries with
different names but pointing to the same object - the second try
to free the part mem pool will fail - since it was freed before -
and issue an abort.
---
 src/bin/edje_cc_handlers.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/bin/edje_cc_handlers.c b/src/bin/edje_cc_handlers.c
index 185eb12..580f6c9 100644
--- a/src/bin/edje_cc_handlers.c
+++ b/src/bin/edje_cc_handlers.c
@@ -2255,6 +2255,8 @@ st_collections_group_name(void)
    Edje_Part_Collection_Directory_Entry *older;
    Edje_Part_Collection *current_pc;
    Eina_List *l = NULL;
+   void *data;
+   Eina_Iterator *it;
 
    check_arg_count(1);
 
@@ -2263,6 +2265,14 @@ st_collections_group_name(void)
    current_de->entry = parse_str(0);
    current_pc->part = current_de->entry;
 
+   it = eina_hash_iterator_data_new(edje_file->collection);
+   while(eina_iterator_next(it, &data))
+     {
+        if (data == current_de)
+          goto double_named_group;
+     }
+   eina_iterator_free(it);
+
    older = eina_hash_find(edje_file->collection, current_de->entry);
    if (older) eina_hash_del(edje_file->collection, current_de->entry, older);
    eina_hash_direct_add(edje_file->collection, current_de->entry, current_de);
@@ -2282,6 +2292,11 @@ st_collections_group_name(void)
           break;
        }
 
+ double_named_group:
+   eina_iterator_free(it);
+   ERR("Invalid group, only a single name statement is valid for group, use "
+       "alias instead.");
+   exit(-1);
 }
 
 typedef struct _Edje_List_Foreach_Data Edje_List_Foreach_Data;
-- 
1.8.0

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to