Christian Brabandt wrote:

> Hi John!
> 
> On Di, 25 Jan 2011, John Beckett wrote:
> 
> > Hoss wrote:
> > > $ find . -mindepth 1 -maxdepth 1 -name '*.pm' | xargs sh -c
> > > '/usr/ local/bin/vim -p "$@" </dev/tty'
> > >
> > > The find command has 60 hits. Now, if I just run this
> > > command, it works fine, and I get 10 tabpages. I want each in
> > > their own tabpage, so I put this in my .vimrc file
> > >
> > > set tpm=60
> > >
> > > With that change, when I run the command, I get the following:
> > >
> > > Vim: Caught deadly signal SEGV
> > > Vim: Finished
> > > Segmentation fault
> > 
> > Please try a simpler test. Does the following lead to a crash?
> 
> I can reproduce this. The problem here is a custom 'tabline' setting and 
> this results in a crash in the build_stl_str_hl() function. I have a 
> rather complicated tabline-setting, that I picked up in vim-use I guess. 
> I never need it though (and in fact tend to forget about it ;))
> 
> Here is a possible fix, that at least prevents the crash, but also 
> prevents drawing the statusline and tabline label. I must admit, I 
> haven't had time to investigate the build_stl_str_hl function in detail, 
> so I don't know the proper fix:
> diff --git a/src/buffer.c b/src/buffer.c
> --- a/src/buffer.c
> +++ b/src/buffer.c
> @@ -3465,9 +3465,9 @@
>         /*
>          * Handle up to the next '%' or the end.
>          */
> -       while (*s != NUL && *s != '%' && p + 1 < out + outlen)
> +       while (*s != NUL && *s != '%' && p + 1 < out + outlen && *p != NUL)
>             *p++ = *s++;
> -       if (*s == NUL || p + 1 >= out + outlen)
> +       if (*s == NUL || p + 1 >= out + outlen || *p == NUL)
>             break;
> 
>         /*
> diff --git a/src/screen.c b/src/screen.c
> --- a/src/screen.c
> +++ b/src/screen.c
> @@ -6429,7 +6429,7 @@
>      int                n;
>      int                len;
>      int                fillchar;
> -    char_u     buf[MAXPATHL];
> +    char_u     buf[MAXPATHL] = "";
>      char_u     *stl;
>      char_u     *p;
>      struct     stl_hlrec hltab[STL_MAX_ITEM];
> 
> 
> Attached is:
> valgrind.log when running the vim -N -i NONE --cmd 'set tpm=65' -p 
> /tmp/vim-crash/* (a directory containing about 60 files)
> tabline.vim My custom tabline setting

Thanks for the patch.  I'll verify it's the right solution soon.

-- 
hundred-and-one symptoms of being an internet addict:
147. You finally give up smoking...because it made the monitor dirty.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
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

Raspunde prin e-mail lui