On Sat, Apr 14, 2012 at 9:36 AM, Christian Brabandt <cbli...@256bit.org> wrote:
> Hi Thomas!
>
> On Fr, 13 Apr 2012, Thomas Dziedzic wrote:
>
>> On Fri, Apr 13, 2012 at 9:00 AM, Taylor Hedberg <tmhedb...@gmail.com> wrote:
>> > Arch x86_64 here and I can reproduce the segfault as well. My Vim is
>> > compiled with +python but not +python3, if that makes any difference.
>>
>> Hi,
>>
>> I was going to report this when I had more time to debug, but since
>> people are already posting it here, I will submit what I have.
>>
>> Yesterday I had a segfault with vim + neocomplcache turned on while
>> editing a file (reproducible).
>> The stack trace from that is at: https://gist.github.com/2377278
>>
>> I can confirm the segfault with :python print "hello"
>> The stack trace is at: https://gist.github.com/2377276
>>
>> They crash in the same location:
>> #0  0x00007ffff4b3f578 in memchr () from /lib/libc.so.6
>> #1  0x00000000005a96e8 in writer (fn=0x4d5f70 <msg>, str=0x0, n=2) at
>> if_py_both.h:172
>> #2  0x00000000005a9912 in OutputWrite (self=<optimized out>,
>> args=<optimized out>) at if_py_both.h:82
>
> I really don't know the interface between Vim and python but I wonder
> why str is null.
> This patch guards against str being Null and should therefore prevent
> the segfault.
> However, this just means :python print "hello" won't return anything, so
> possibly parsing the argument gets wrong somewhere before.
>
> diff --git a/src/if_py_both.h b/src/if_py_both.h
> --- a/src/if_py_both.h
> +++ b/src/if_py_both.h
> @@ -74,7 +74,7 @@
>     char *str = NULL;
>     int error = ((OutputObject *)(self))->error;
>
> -    if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
> +    if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len) || str == NUL)
>        return NULL;
>
>     Py_BEGIN_ALLOW_THREADS
>
>
> regards,
> Christian
>
> --
> 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

Breakpoint 1, OutputWrite (self=0x83d2e0, args=0x7ffff7eda4d0) at
if_py_both.h:77
77      in if_py_both.h
(gdb) info locals
len = 0
str = 0x7ffff4703cb0 "g6"
error = <optimized out>
(gdb) continue
Continuing.

Breakpoint 2, OutputWrite (self=<optimized out>, args=<optimized out>)
at if_py_both.h:80
80      in if_py_both.h
(gdb) info locals
_save = <optimized out>
len = 8
str = 0x0
error = 0

It seems that str is for some reason getting set to null even if
everything appears to be ok..
Nick's comment also makes me think it might possibly have something to
do with the recent gcc 4.7 update.

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