From 8a7e99b67e123aae0d3dfed3d56b9d2fc0caca3f Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Tue, 29 Jan 2013 00:07:17 +0000 Subject: [PATCH] edje - [Edje: Bug fix] NULL check is added before strcmp() in _edje_real_part_swallow() function Hi, Can some one please verify and merge the attahed patch with open source svn Edje code. [Issue details :] NULL checking is not done before sending a string to strcmp(). In _edje_real_part_swallow() function of edje_util.c file, evas_object_type_get() API can return NULL and if this NULL value is directly passed to strcmp(), it causes a crash. [Issue fix :] NULL check is added for obj_type before passing it to strcmp(). Thanks & Regards, Sumanth Signed-Off-By: Sumanth Krishna (sumanth.m@samsung.com) SVN revision: 83393 --- ChangeLog | 5 +++++ NEWS | 1 + src/lib/edje/edje_util.c | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 47f89f6bf1..8a30f66763 100644 --- a/ChangeLog +++ b/ChangeLog @@ -385,3 +385,8 @@ * Ecore_Evas wayland-egl only renders now if last frame has been presented. + +2013-01-29 Sumanth Krishna Mannam + + * Prevent a crash even if an invalid object is swallowed into an + edje object. diff --git a/NEWS b/NEWS index 3781556838..c8b254fd16 100644 --- a/NEWS +++ b/NEWS @@ -131,3 +131,4 @@ Fixes: * Fixed pixman surface alloc where allocated and image size differ. * Fixed x11 error sync issue with ecore_x_image_get() * Fix evas gif loader to return the correct frame duration + * Prevent a crash even if an invalid object is swallowed into an edje object. diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index d8967d1e10..e6b30e0b2b 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -6401,6 +6401,8 @@ _edje_real_part_swallow(Edje_Real_Part *rp, Evas_Object *obj_swallow, Eina_Bool hints_update) { + const char *obj_type; + if ((rp->type != EDJE_RP_TYPE_SWALLOW) || (!rp->typedata.swallow)) return; if (rp->typedata.swallow->swallowed_object) @@ -6440,7 +6442,8 @@ _edje_real_part_swallow(Edje_Real_Part *rp, rp); //If the map is enabled, uv should be updated when image size is changed. - if (!strcmp(evas_object_type_get(rp->typedata.swallow->swallowed_object), "image")) + obj_type = evas_object_type_get(rp->typedata.swallow->swallowed_object); + if (obj_type && !strcmp(obj_type, "image")) evas_object_event_callback_add(obj_swallow, EVAS_CALLBACK_IMAGE_RESIZE, _edje_object_part_swallow_image_resize_cb, rp);