jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d4444bf7a0e368097bec5558b98ddf1ea8818e3e
commit d4444bf7a0e368097bec5558b98ddf1ea8818e3e Author: Mykyta Biliavskyi <m.biliavs...@samsung.com> Date: Tue Sep 8 18:34:16 2015 +0900 Edje_cc: check value for text.source attribute. Summary: Add additional check for description.text.source and description.text.text_source attributes in TEXT part. For cases when as source uses non TEXT/TEXTBLOCK part serialization process should be stopped. This will cause segmentation fault on runtime. (see edje_text.c line 251) Reviewers: Hermet, raster, cedric, jpeg Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3026 Signed-off-by: Jean-Philippe Andre <jp.an...@samsung.com> --- src/bin/edje/edje_cc_out.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c index 6a85f66..f40687d 100644 --- a/src/bin/edje/edje_cc_out.c +++ b/src/bin/edje/edje_cc_out.c @@ -382,6 +382,35 @@ check_image_part_desc(Edje_Part_Collection *pc, Edje_Part *ep, } } +static void +check_text_part_desc(Edje_Part_Collection *pc, Edje_Part *ep, + Edje_Part_Description_Text *epd, Eet_File *ef) +{ + 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)) + { + 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)) + { + 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); + } + } +} + /* This function check loops between groups. For example: > part in group A. It's source is B. @@ -502,6 +531,14 @@ check_part(Edje_Part_Collection *pc, Edje_Part *ep, Eet_File *ef) check_packed_items(pc, ep, ef); else if (ep->type == EDJE_PART_TYPE_GROUP) check_source_links(pc, ep, ef, group_path); + else if (ep->type == EDJE_PART_TYPE_TEXT) + { + check_text_part_desc(pc, ep, (Edje_Part_Description_Text*) ep->default_desc, ef); + + for (i = 0; i < ep->other.desc_count; ++i) + check_text_part_desc(pc, ep, (Edje_Part_Description_Text*) ep->other.desc[i], ef); + } + /* FIXME: When smart masks are supported, remove this check */ if (ep->clip_to_id != -1 && --