From 330a1422342e9d642367ce0535c998b03ed2bb67 Mon Sep 17 00:00:00 2001 From: Prateek Thakur Date: Thu, 12 Oct 2023 15:04:37 +0530 Subject: [PATCH] efl_ui_widget: add safety check and prevent infinite loop If sdp is null it will be stuck in infite loop as parent object is not updated. Break from while loop if sdp is null. ref: DF231003-00328 Change-Id: Ib49a1cef3f1282cab6b692edc737988a1e2e8775 Signed-off-by: Prateek Thakur --- src/lib/elementary/efl_ui_widget.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) mode change 100644 => 100755 src/lib/elementary/efl_ui_widget.c diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c old mode 100644 new mode 100755 index c9fd50a..364046a --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -1828,26 +1828,22 @@ _efl_ui_widget_widget_sub_object_del(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob Evas_Object *subobj; ELM_WIDGET_DATA_GET(parent, sdp); - //TIZEN_ONLY(20230912): Improved safety of efl_ui_widget_sub_object_del - if (sdp) + if (!sdp) break; + sdp->child_can_focus = EINA_FALSE; + for (unsigned int i = 0; i < eina_array_count(sdp->children); ++i) { - sdp->child_can_focus = EINA_FALSE; - for (unsigned int i = 0; i < eina_array_count(sdp->children); ++i) + subobj = eina_array_data_get(sdp->children, i); + if ((subobj != sobj) && (_is_focusable(subobj))) { - subobj = eina_array_data_get(sdp->children, i); - if ((subobj != sobj) && (_is_focusable(subobj))) - { - sdp->child_can_focus = EINA_TRUE; - break; - } + sdp->child_can_focus = EINA_TRUE; + break; } - - /* break again, child_can_focus went back to - * original value */ - if (sdp->child_can_focus) break; - parent = sdp->parent_obj; } - // + + /* break again, child_can_focus went back to + * original value */ + if (sdp->child_can_focus) break; + parent = sdp->parent_obj; } } // -- 2.7.4