diff options
author | Mykyta Biliavskyi <m.biliavskyi@samsung.com> | 2015-09-08 18:34:16 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2015-09-08 18:41:19 +0900 |
commit | d4444bf7a0e368097bec5558b98ddf1ea8818e3e (patch) | |
tree | 03e51bc53aa5c02e1e222c0cc56e332bd65e7a7f /src | |
parent | 1b049b6fba3dc47bf0345cc3bbfae169ad982919 (diff) |
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.andre@samsung.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/edje/edje_cc_out.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c index 6a85f666b0..f40687d86a 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, | |||
382 | } | 382 | } |
383 | } | 383 | } |
384 | 384 | ||
385 | static void | ||
386 | check_text_part_desc(Edje_Part_Collection *pc, Edje_Part *ep, | ||
387 | Edje_Part_Description_Text *epd, Eet_File *ef) | ||
388 | { | ||
389 | if (epd->text.id_source != -1) | ||
390 | { | ||
391 | if ((pc->parts[epd->text.id_source]->type != EDJE_PART_TYPE_TEXT) && | ||
392 | (pc->parts[epd->text.id_source]->type != EDJE_PART_TYPE_TEXTBLOCK)) | ||
393 | { | ||
394 | error_and_abort(ef, "Collection \"%s\" Part \"%s\" Description \"%s\" [%.3f]: " | ||
395 | "text.source point to a non TEXT part \"%s\"!", | ||
396 | pc->part, ep->name,epd->common.state.name, | ||
397 | epd->common.state.value, pc->parts[epd->text.id_source]->name); | ||
398 | } | ||
399 | } | ||
400 | |||
401 | if (epd->text.id_text_source != -1) | ||
402 | { | ||
403 | if ((pc->parts[epd->text.id_text_source]->type != EDJE_PART_TYPE_TEXT) && | ||
404 | (pc->parts[epd->text.id_text_source]->type != EDJE_PART_TYPE_TEXTBLOCK)) | ||
405 | { | ||
406 | error_and_abort(ef, "Collection \"%s\" Part \"%s\" Description \"%s\" [%.3f]: " | ||
407 | "text.text_source point to a non TEXT part \"%s\"!", | ||
408 | pc->part, ep->name,epd->common.state.name, | ||
409 | epd->common.state.value, pc->parts[epd->text.id_text_source]->name); | ||
410 | } | ||
411 | } | ||
412 | } | ||
413 | |||
385 | /* This function check loops between groups. | 414 | /* This function check loops between groups. |
386 | For example: | 415 | For example: |
387 | > part in group A. It's source is B. | 416 | > 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) | |||
502 | check_packed_items(pc, ep, ef); | 531 | check_packed_items(pc, ep, ef); |
503 | else if (ep->type == EDJE_PART_TYPE_GROUP) | 532 | else if (ep->type == EDJE_PART_TYPE_GROUP) |
504 | check_source_links(pc, ep, ef, group_path); | 533 | check_source_links(pc, ep, ef, group_path); |
534 | else if (ep->type == EDJE_PART_TYPE_TEXT) | ||
535 | { | ||
536 | check_text_part_desc(pc, ep, (Edje_Part_Description_Text*) ep->default_desc, ef); | ||
537 | |||
538 | for (i = 0; i < ep->other.desc_count; ++i) | ||
539 | check_text_part_desc(pc, ep, (Edje_Part_Description_Text*) ep->other.desc[i], ef); | ||
540 | } | ||
541 | |||
505 | 542 | ||
506 | /* FIXME: When smart masks are supported, remove this check */ | 543 | /* FIXME: When smart masks are supported, remove this check */ |
507 | if (ep->clip_to_id != -1 && | 544 | if (ep->clip_to_id != -1 && |