From ce9379398fdc3a99df1f212a349cfdac5fef4d3b Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Mon, 11 Jul 2016 11:19:01 -0400 Subject: [PATCH] edje: Fix issue of null pointer dereference Coverity reports that 'text' here is a null pointer dereference so check for valid 'text' variable before trying to use it. Fixes Coverity CID1267490 @fix Signed-off-by: Chris Michael --- src/lib/edje/edje_load.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 85dc114147..c370a72f9e 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -1041,21 +1041,31 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch Edje_Part_Description_Text *text; text = (Edje_Part_Description_Text *)rp->param1.description; - - if (ed->file->feature_ver < 1) + if (text) { - text->text.id_source = -1; - text->text.id_text_source = -1; + if (ed->file->feature_ver < 1) + { + text->text.id_source = -1; + text->text.id_text_source = -1; + } + + if ((rp->type == EDJE_RP_TYPE_TEXT) && + (rp->typedata.text)) + { + if (text->text.id_source >= 0) + { + rp->typedata.text->source = + ed->table_parts[text->text.id_source % ed->table_parts_size]; + } + + if (text->text.id_text_source >= 0) + { + rp->typedata.text->text_source = + ed->table_parts[text->text.id_text_source % ed->table_parts_size]; + } + } } - if ((rp->type == EDJE_RP_TYPE_TEXT) && - (rp->typedata.text)) - { - if (text->text.id_source >= 0) - rp->typedata.text->source = ed->table_parts[text->text.id_source % ed->table_parts_size]; - if (text->text.id_text_source >= 0) - rp->typedata.text->text_source = ed->table_parts[text->text.id_text_source % ed->table_parts_size]; - } if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) { _edje_entry_real_part_init(ed, rp);