On Wed, 22 Dec 2010 18:10:09 -0500
Christopher Michael <[email protected]> wrote:

> On 12/22/2010 06:04 PM, Mike Blumenkrantz wrote:
> > On Wed, 22 Dec 2010 17:59:28 -0500
> > Christopher Michael<[email protected]>  wrote:
> >
> >> On 12/22/2010 05:56 PM, Mike Blumenkrantz wrote:
> >>> On Wed, 22 Dec 2010 17:46:10 -0500
> >>> Christopher Michael<[email protected]>   wrote:
> >>>
> >>>> Is there a backtrace for this segfault ?? I'm asking because the illume2
> >>>> keyboard module has very similar code, and I've never seen it segfault
> >>>> here.
> >>>>
> >>>> Thanks,
> >>>> dh
> >>>>
> >>>> On 12/22/2010 05:22 PM, Enlightenment SVN wrote:
> >>>>> Log:
> >>>>> this will avoid a segv, but the entire function is broken and should be
> >>>>> looked at by someone who knows the code
> >>>>>
> >>>>>
> >>>>> Author:       discomfitor
> >>>>> Date:         2010-12-22 14:22:59 -0800 (Wed, 22 Dec 2010)
> >>>>> New Revision: 55698
> >>>>> Trac:         http://trac.enlightenment.org/e/changeset/55698
> >>>>>
> >>>>> Modified:
> >>>>>      trunk/e/src/modules/illume/e_kbd_buf.c
> >>>>>
> >>>>> Modified: trunk/e/src/modules/illume/e_kbd_buf.c
> >>>>> ===================================================================
> >>>>> --- trunk/e/src/modules/illume/e_kbd_buf.c      2010-12-22 11:23:30
> >>>>> UTC (rev 55697) +++ trunk/e/src/modules/illume/e_kbd_buf.c
> >>>>> 2010-12-22 22:22:59 UTC (rev 55698) @@ -164,9 +164,10 @@
> >>>>>              if ((actual_len + strlen(str) + 1)>    actual_size)
> >>>>>                {
> >>>>>                   actual_size += 64;
> >>>>> -                 actual = realloc(actual, actual_size);
> >>>>> +                 actual = malloc(actual_size);
> >>>>> +                  EINA_SAFETY_ON_NULL_RETURN(actual);
> >>>>> +                  strcpy(actual, str);
> >>>>>                }
> >>>>> -            strcpy(actual + actual_len, str);
> >>>>>              actual_len += strlen(str);
> >>>>>           }
> >>>>>          }
> >>>>>
> >>>>
> >>
> >>> I don't know if the segv has ever occurred, but I'm running clang on e
> >>> because I've been getting too many crashes lately and found this :)
> >>>
> >>
> >> Ok. Well I am asking because of your commit message: "this will avoid a
> >> segv, but the entire function is broken" .. How is it broken ??
> >>
> >> Remember tho ... you can't always believe what clang tells ya ;)
> >>
> >> dh
> > oh I know, I read through it all carefully before deciding to change
> > anything.
> 
> :)
> 
> > this function seems to be assuming that all the variables at the top are
> > getting assigned or something (>  0 checks, for instance?) which leads me to
> > believe that someone was thinking about something else while they were
> > working :)
> >
> Well, from what I am reading, there are getting assigned some values 
> initially:
> 
>     char *actual = NULL;
>     int actual_len = 0;
>     int actual_size = 0;
> 
> Hmm, not seeing any > 0 checks in that function ... tho there is a > 1 
> check ;) to make sure that the str returned from the previous function 
> call (_e_kbd_buf_keystroke_string_get) is valid.
> 
> I'm not arguing with your change, it seems fine :) I'm just wondering 
> about the 'segfault' or 'broken code' statement ;)
> 
> dh
> 
unless I'm mistaken, actual_len and actual_size are both 0 here:
if ((actual_len + strlen(str) + 1) > actual_size)
which leads to somewhat misleading code which should probably be tidied up
to avoid giving the wrong impression ;)

-- 
Mike Blumenkrantz
Zentific: We run the three-legged race individually.

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to