Bram Moolenaar wrote:
> Francisco Lopes wrote:
> 
> 
> 
> > I've applied the following patch to pum_redraw function to avoid rare 
> > segfaults I was suffering.
> 
> > 
> 
> > diff -r 92c9748e0ccb src/popupmnu.c
> 
> > --- a/src/popupmnu.c        Sun Oct 06 17:46:56 2013 +0200
> 
> > +++ b/src/popupmnu.c        Mon Oct 21 12:29:31 2013 -0200
> 
> > @@ -295,6 +295,8 @@
> 
> >      for (i = 0; i < pum_height; ++i)
> 
> >      {
> 
> >     idx = i + pum_first;
> 
> > +   if(idx >= pum_height)
> 
> > +       break;
> 
> >     attr = (idx == pum_selected) ? attr_select : attr_norm;
> 
> >  
> 
> >     /* prepend a space if there is room */
> 
> > 
> 
> > I've discovered the situation while debugging
> 
> > https://github.com/Valloric/YouCompleteMe/issues/593 but I'm unable to
> 
> > explain all the characteristics that leads to the segfault situation
> 
> > (that happens only occasionally). I just verified that idx was getting
> 
> > beyond pum_height in the last step of the loop, and this was a problem
> 
> > when accessing pum_array[idx], for example, referencing invalid
> 
> > memory.
> 
> 
> 
> Thanks for the patch.  It would be good if you at least have an idea why
> 
> this happens.  Perhaps pum_first is changed inside the loop?
> 

I really didn't seek quite deep to figure out how the situation got setup, but, 
it seems clear there's a problem with that coding since it uses idx to index 
stuff but it should go beyond pum_height anytime pum_first is greater than 0.

Sorry for not digging it depply.

Regards,
Francisco Lopes.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui