From 50127bc4dfc58dae3d8c20c7dc106ed0818fc0f9 Mon Sep 17 00:00:00 2001 From: Jaeun Choi Date: Tue, 21 Apr 2015 14:30:41 +0900 Subject: [PATCH] elm: add safety check when insert a new item before/after an item, the relative item should not be NULL. this patch fixes naviframe, gengrid, genlist, list, and toolbar. @fix --- legacy/elementary/src/lib/elc_naviframe.c | 3 +++ legacy/elementary/src/lib/elm_gengrid.c | 2 ++ legacy/elementary/src/lib/elm_genlist.c | 2 ++ legacy/elementary/src/lib/elm_list.c | 2 ++ legacy/elementary/src/lib/elm_toolbar.c | 2 ++ 5 files changed, 11 insertions(+) diff --git a/legacy/elementary/src/lib/elc_naviframe.c b/legacy/elementary/src/lib/elc_naviframe.c index 9d2b7c5..b14d203 100644 --- a/legacy/elementary/src/lib/elc_naviframe.c +++ b/legacy/elementary/src/lib/elc_naviframe.c @@ -1570,6 +1570,8 @@ _elm_naviframe_item_insert_before(Eo *obj, Elm_Naviframe_Data *sd, Elm_Object_It { Elm_Object_Item *eo_it; Elm_Naviframe_Item_Data *prev_it = NULL; + + EINA_SAFETY_ON_NULL_RETURN_VAL(eo_before, NULL); ELM_NAVIFRAME_ITEM_DATA_GET(eo_before, before); ELM_NAVIFRAME_ITEM_CHECK_OR_RETURN(before, NULL); @@ -1604,6 +1606,7 @@ _elm_naviframe_item_insert_after(Eo *obj, Elm_Naviframe_Data *sd, Elm_Object_Ite Elm_Object_Item *eo_item; Eina_Bool top_inserted = EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(eo_after, NULL); ELM_NAVIFRAME_ITEM_DATA_GET(eo_after, after); ELM_NAVIFRAME_ITEM_CHECK_OR_RETURN(after, NULL); diff --git a/legacy/elementary/src/lib/elm_gengrid.c b/legacy/elementary/src/lib/elm_gengrid.c index 9a4937e..f22886e 100644 --- a/legacy/elementary/src/lib/elm_gengrid.c +++ b/legacy/elementary/src/lib/elm_gengrid.c @@ -3942,6 +3942,7 @@ _elm_gengrid_item_insert_before(Eo *obj, Elm_Gengrid_Data *sd, const Elm_Gengrid { Elm_Gen_Item *it; Eina_Inlist *tmp; + EINA_SAFETY_ON_NULL_RETURN_VAL(eo_relative, NULL); ELM_GENGRID_ITEM_DATA_GET(eo_relative, relative); ELM_GENGRID_ITEM_CHECK_OR_RETURN(relative, NULL); @@ -3969,6 +3970,7 @@ _elm_gengrid_item_insert_after(Eo *obj, Elm_Gengrid_Data *sd, const Elm_Gengrid_ { Elm_Gen_Item *it; Eina_Inlist *tmp; + EINA_SAFETY_ON_NULL_RETURN_VAL(eo_relative, NULL); ELM_GENGRID_ITEM_DATA_GET(eo_relative, relative); ELM_GENGRID_ITEM_CHECK_OR_RETURN(relative, NULL); diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index 18faf44..17fa6d3 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -6077,6 +6077,7 @@ _elm_genlist_item_prepend(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const Elm_G EOLIAN static Elm_Object_Item* _elm_genlist_item_insert_after(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Object_Item *eo_parent, Elm_Object_Item *eo_after, Elm_Genlist_Item_Type type, Evas_Smart_Cb func, const void *func_data) { + EINA_SAFETY_ON_NULL_RETURN_VAL(eo_after, NULL); ELM_GENLIST_ITEM_DATA_GET(eo_after, after); Elm_Gen_Item *it; @@ -6126,6 +6127,7 @@ _elm_genlist_item_insert_after(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const EOLIAN static Elm_Object_Item* _elm_genlist_item_insert_before(Eo *obj, Elm_Genlist_Data *sd, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Object_Item *eo_parent, Elm_Object_Item *eo_before, Elm_Genlist_Item_Type type, Evas_Smart_Cb func, const void *func_data) { + EINA_SAFETY_ON_NULL_RETURN_VAL(eo_before, NULL); ELM_GENLIST_ITEM_DATA_GET(eo_before, before); Elm_Gen_Item *it; diff --git a/legacy/elementary/src/lib/elm_list.c b/legacy/elementary/src/lib/elm_list.c index 8be1ab2..d7db7da 100644 --- a/legacy/elementary/src/lib/elm_list.c +++ b/legacy/elementary/src/lib/elm_list.c @@ -2846,6 +2846,7 @@ EOLIAN static Elm_Object_Item* _elm_list_item_insert_before(Eo *obj, Elm_List_Data *sd, Elm_Object_Item *eo_before, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data) { Elm_List_Item_Data *it; + EINA_SAFETY_ON_NULL_RETURN_VAL(eo_before, NULL); ELM_LIST_ITEM_DATA_GET(eo_before, before_it); ELM_LIST_ITEM_CHECK_OR_RETURN(before_it, NULL); @@ -2867,6 +2868,7 @@ EOLIAN static Elm_Object_Item* _elm_list_item_insert_after(Eo *obj, Elm_List_Data *sd, Elm_Object_Item *eo_after, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data) { Elm_List_Item_Data *it; + EINA_SAFETY_ON_NULL_RETURN_VAL(eo_after, NULL); ELM_LIST_ITEM_DATA_GET(eo_after, after_it); ELM_LIST_ITEM_CHECK_OR_RETURN(after_it, NULL); diff --git a/legacy/elementary/src/lib/elm_toolbar.c b/legacy/elementary/src/lib/elm_toolbar.c index c588e36..93e1b25 100644 --- a/legacy/elementary/src/lib/elm_toolbar.c +++ b/legacy/elementary/src/lib/elm_toolbar.c @@ -2987,6 +2987,7 @@ _elm_toolbar_item_insert_before(Eo *obj, Elm_Toolbar_Data *sd, Elm_Object_Item * Elm_Toolbar_Item_Data *it; double scale; + EINA_SAFETY_ON_NULL_RETURN_VAL(eo_before, NULL); ELM_TOOLBAR_ITEM_DATA_GET(eo_before, _before); ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(_before, NULL); @@ -3010,6 +3011,7 @@ _elm_toolbar_item_insert_after(Eo *obj, Elm_Toolbar_Data *sd, Elm_Object_Item *e Elm_Toolbar_Item_Data *it; double scale; + EINA_SAFETY_ON_NULL_RETURN_VAL(eo_after, NULL); ELM_TOOLBAR_ITEM_DATA_GET(eo_after, _after); ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(_after, NULL); -- 2.7.4