You're right.
Some of static code analyzer(i.e. coverity, we are currently using) could
return false-alarm like this case.
In this case, _list_last_recursive() could return NULL value.

_list_lat_recursive()
{
   ...
   ll = eina_list_last(..) ;
   if (!ll) return NULL;
   ...
}
Means that caller may need somehow null handling in analyzer point of
view... though  we obviously know eina_list_last() does what inside.

My point is, just here null-check is a just trivial but it would protect us
from stupid tools and potential errors from functional-coupling.


On Thu, Sep 27, 2018 at 4:08 PM Marcel Hollerbach <m...@bu5hm4n.de> wrote:

> If ll is NULL then rel->item->items must be NULL ... i dont see how
> _list_last_recursive can return NULL otherwise.
>
> Greetings,
>     bu5hm4n
>
> On 9/27/18 7:08 AM, Yeongjong Lee wrote:
> > hermet pushed a commit to branch master.
> >
> >
> http://git.enlightenment.org/core/efl.git/commit/?id=39de8cdc752f4454dc173c42300126c76dc6c2bc
> >
> > commit 39de8cdc752f4454dc173c42300126c76dc6c2bc
> > Author: Yeongjong Lee <yj34....@samsung.com>
> > Date:   Thu Sep 27 14:08:39 2018 +0900
> >
> >      elm_genlist: prevent null pointer access
> >
> >      Summary: found by coverity
> >
> >      Reviewers: Hermet
> >
> >      Reviewed By: Hermet
> >
> >      Subscribers: cedric, #reviewers, #committers
> >
> >      Tags: #efl
> >
> >      Differential Revision: https://phab.enlightenment.org/D7108
> > ---
> >   src/lib/elementary/elm_genlist.c | 7 +++++--
> >   1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/lib/elementary/elm_genlist.c
> b/src/lib/elementary/elm_genlist.c
> > index 2dac08d1b8..319d126baa 100644
> > --- a/src/lib/elementary/elm_genlist.c
> > +++ b/src/lib/elementary/elm_genlist.c
> > @@ -6637,8 +6637,11 @@ _elm_genlist_item_sorted_insert(Eo *obj,
> Elm_Genlist_Data *sd, const Elm_Genlist
> >                     if (rel->item->items)
> >                       {
> >                          Eina_List *ll =
> _list_last_recursive(rel->item->items);
> > -                       eo_rel = ll->data;
> > -                       rel = efl_data_scope_get(eo_rel,
> ELM_GENLIST_ITEM_CLASS);
> > +                       if (ll)
> > +                         {
> > +                            eo_rel = ll->data;
> > +                            rel = efl_data_scope_get(eo_rel,
> ELM_GENLIST_ITEM_CLASS);
> > +                         }
> >                       }
> >                     sd->items = eina_inlist_append_relative
> >                         (sd->items, EINA_INLIST_GET(it),
> EINA_INLIST_GET(rel));
> >
>
>
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>


-- 
Regards, Hermet

_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to