If you create an edc file with the two following styles:

styles {
    style {
        base: "foo";
    }
    style {
        name: "bar";
        base: "foo2";
    }
}

edje_cc would SEGV when comparing whether the second style's name is equal to the previous one.

The attached patch avoids that behavior and tries at least to print an error message indicating that the user has forgotten some style name.

--
Rafael Fonseca
ProFUSION embedded systems
http://www.profusion.mobi
Index: edje_cc_parse.c
===================================================================
--- edje_cc_parse.c     (revision 49921)
+++ edje_cc_parse.c     (working copy)
@@ -644,6 +644,8 @@
    int fd;
    off_t size;
    char *data, *p;
+   Eina_List *l;
+   Edje_Style *stl;
 
    if (!tmp_dir)
 #ifdef HAVE_EVIL
@@ -807,6 +809,13 @@
      }
    free(data);
    close(fd);
+
+   EINA_LIST_FOREACH(edje_file->styles, l, stl)
+      if (!stl->name)
+       {
+          ERR("%s: Error. style must have a name.", progname);
+          exit(-1);
+       }
 }
 
 int
Index: edje_cc_handlers.c
===================================================================
--- edje_cc_handlers.c  (revision 49921)
+++ edje_cc_handlers.c  (working copy)
@@ -1586,7 +1586,7 @@
    stl->name = parse_str(0);
    EINA_LIST_FOREACH(edje_file->styles, l, tstl)
      {
-       if ((stl != tstl) && (!strcmp(stl->name, tstl->name)))
+       if (stl->name && tstl->name && (stl != tstl) && (!strcmp(stl->name, 
tstl->name)))
          {
             ERR("%s: Error. parse error %s:%i. There is already a style named 
\"%s\"",
                 progname, file_in, line - 1, stl->name);
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to