jpeg pushed a commit to branch master.

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

commit 7c8ca6b752b3f584b84aac78d8ee28bf6a6f562a
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Thu Oct 1 17:34:20 2015 +0900

    edje_cc: Fix TEXT part validation for aliased parts
    
    Not 100% sure of this fix but it "works". This is just compile-time
    safety checking code after all, so it won't impact any existing
    application.
    
    This fixes commit d4444bf7a0e368097bec555. Tested with empc.
    
    Thanks @zmike for the report and test case.
---
 src/bin/edje/edje_cc_out.c | 80 ++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 67 insertions(+), 13 deletions(-)

diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c
index c0264e6..5c79ee8 100644
--- a/src/bin/edje/edje_cc_out.c
+++ b/src/bin/edje/edje_cc_out.c
@@ -382,32 +382,86 @@ check_image_part_desc(Edje_Part_Collection *pc, Edje_Part 
*ep,
     }
 }
 
+static Edje_Part_Collection *
+_source_group_find(const char *source)
+{
+   Edje_Part_Collection *pc2;
+   Eina_List *l;
+   if (!source) return NULL;
+   EINA_LIST_FOREACH(edje_collections, l, pc2)
+     {
+        if (!strcmp(pc2->part, source))
+          return pc2;
+     }
+   return NULL;
+}
+
+static Edje_Part *
+_aliased_text_part_find(Edje_Part_Collection *pc,
+                        int id_source, const char *id_source_part)
+{
+   Edje_Part_Collection *group;
+   unsigned int i;
+
+   if (!pc->parts[id_source]->source)
+     return NULL;
+
+   group = _source_group_find(pc->parts[id_source]->source);
+   if (!group) return NULL;
+
+   for (i = 0; i < group->parts_count; i++)
+     {
+        if (!strcmp(group->parts[i]->name, id_source_part))
+          return group->parts[i];
+     }
+   return NULL;
+}
+
 static void
 check_text_part_desc(Edje_Part_Collection *pc, Edje_Part *ep,
-                      Edje_Part_Description_Text *epd, Eet_File *ef)
+                     Edje_Part_Description_Text *epd, Eet_File *ef)
 {
+   Edje_Part *ep2;
+
    if (epd->text.id_source != -1)
      {
-        if ((pc->parts[epd->text.id_source]->type != EDJE_PART_TYPE_TEXT) &&
-            (pc->parts[epd->text.id_source]->type != EDJE_PART_TYPE_TEXTBLOCK))
+        if ((pc->parts[epd->text.id_source]->type == EDJE_PART_TYPE_TEXT) ||
+            (pc->parts[epd->text.id_source]->type == EDJE_PART_TYPE_TEXTBLOCK))
+          return;
+
+        if (epd->text.id_source_part)
           {
-             error_and_abort(ef, "Collection \"%s\" Part \"%s\" Description 
\"%s\" [%.3f]: "
-                          "text.source point to a non TEXT part \"%s\"!",
-                          pc->part, ep->name,epd->common.state.name,
-                          epd->common.state.value, 
pc->parts[epd->text.id_source]->name);
+             ep2 = _aliased_text_part_find(pc, epd->text.id_source, 
epd->text.id_source_part);
+             if (ep2 && ((ep2->type == EDJE_PART_TYPE_TEXT) ||
+                         (ep2->type == EDJE_PART_TYPE_TEXTBLOCK)))
+               return;
           }
+
+        error_and_abort(ef, "Collection \"%s\" Part \"%s\" Description \"%s\" 
[%.3f]: "
+                            "text.source point to a non TEXT part \"%s\"!",
+                        pc->part, ep->name, epd->common.state.name,
+                        epd->common.state.value, 
pc->parts[epd->text.id_source]->name);
      }
 
    if (epd->text.id_text_source != -1)
      {
-        if ((pc->parts[epd->text.id_text_source]->type != EDJE_PART_TYPE_TEXT) 
&&
-            (pc->parts[epd->text.id_text_source]->type != 
EDJE_PART_TYPE_TEXTBLOCK))
+
+        if ((pc->parts[epd->text.id_text_source]->type == EDJE_PART_TYPE_TEXT) 
||
+            (pc->parts[epd->text.id_text_source]->type == 
EDJE_PART_TYPE_TEXTBLOCK))
+          return;
+
+        if (epd->text.id_text_source_part)
           {
-             error_and_abort(ef, "Collection \"%s\" Part \"%s\" Description 
\"%s\" [%.3f]: "
-                          "text.text_source point to a non TEXT part \"%s\"!",
-                          pc->part, ep->name,epd->common.state.name,
-                          epd->common.state.value, 
pc->parts[epd->text.id_text_source]->name);
+             ep2 = _aliased_text_part_find(pc, epd->text.id_text_source, 
epd->text.id_text_source_part);
+             if (ep2 && ((ep2->type == EDJE_PART_TYPE_TEXT) ||
+                         (ep2->type == EDJE_PART_TYPE_TEXTBLOCK)))
+               return;
           }
+
+        error_and_abort(ef, "Collection \"%s\" Part \"%s\" Description \"%s\" 
[%.3f]: "
+                            "text.text_source point to a non TEXT part 
\"%s\"!",
+                        pc->part, ep->name,epd->common.state.name,
+                        epd->common.state.value, 
pc->parts[epd->text.id_text_source]->name);
      }
 }
 

-- 


Reply via email to