Dominique Pellé wrote:

> Bram Moolenaar <[email protected]> wrote:
> 
> > Elimar Riesebieter wrote:
> >
> >> * Dominique Pellé <[email protected]> [2016-02-28 12:08 +0100]:
> >>
> >> > Elimar Riesebieter <[email protected]> wrote:
> >>
> >> [...]
> >> > Can you give us a backtrace with gdb?
> >>
> >> No. Can't find a core file anywhere.
> >>
> >> > You can get it from the core file using:
> >> >
> >> > $ cd vim/src/testdir
> >> > $ make clean
> >> > $ rm core
> >> > $ make test_channel.res
> >>
> >> Well running this as user works as it should. So the only difference
> >> are the environment variables. My build wrapper has set LANG=C and
> >> LC_ALL=C. Setting LANG=en_US.UTF-8 and LC_ALL=en_US.UTF-8 seems to
> >> solve the issue.
> >>
> >> It looks like an UTF-8 environment is required for running the
> >> tests?
> >
> > No, but this problem does point in the direction of the conversion
> > recently added to JSON encoding/decoding.
> >
> > A simple way to try this out is to find vimconv_T in json.c.  Below it
> > you will find:
> >
> >         if (!enc_utf8)
> >
> > Change that to:
> >
> >         if (FALSE)
> >
> > There are two of these.  Let us know if that solved the problem.
> 
> 
> I can reproduce the crash now on xubuntu-14.04 x86_64
> after doing:
> 
> $ cd src/testdir
> $ export LC_ALL=C
> $ export LANG=C
> $ export LANGUAGE=C
> $ make test_channel.res
> ...
> Vim: Caught deadly signal SEGV
> 
> Vim: Finished.
> Segmentation fault (core dumped)
> 
> 
> Valgrind reports:
> 
> ==12517== Memcheck, a memory error detector
> ==12517== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
> ==12517== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
> ==12517== Command: ../vim -f -u unix.vim -U NONE --noplugin
> --not-a-term -u NONE -U NONE -S runtest.vim test_channel.vim
> ==12517== Parent PID: 12516
> ==12517==
> ==12517== Invalid read of size 1
> ==12517==    at 0x5AF581: json_decode_string (json.c:671)
> ==12517==    by 0x5AF581: json_decode_item (json.c:714)
> ==12517==    by 0x5AF906: json_decode_array (json.c:388)
> ==12517==    by 0x5AF906: json_decode_item (json.c:708)
> ==12517==    by 0x5B01DA: json_decode (json.c:884)
> ==12517==    by 0x5AD0A8: channel_parse_json (channel.c:1091)
> ==12517==    by 0x5AEA9E: channel_read_json_block (channel.c:1987)
> ==12517==    by 0x442A17: ch_expr_common (eval.c:10590)

[...]

> json.c:
> 
>   666 #if defined(FEAT_MBYTE) && defined(USE_ICONV)
> !!667     vim_free(converted);
>   668 #endif
>   669
>   670     reader->js_used = (int)(p - reader->js_buf);
> !!671     if (*p == '"')
>   672     {
> 
> p at line json.c:671 points inside the buffer 'converted' freed
> just a  few lines above at json.c:667.
> 
> I don't have the time to look further now, but hopefully
> this is enough information to reproduce and fix it.

I found a similar problem.  That was fixed by 7.4.1445.  But there is
another problem.  I followed your setup and was able to reproduce: the
resulting string is missing a NUL byte.  Strange that valgrind didn't
complain, possibly because the string is allocated and may have a NUL
byte somewhere.

-- 
INSPECTOR END OF FILM: Move along.  There's nothing to see!  Keep moving!
   [Suddenly he notices the cameras.]
INSPECTOR END OF FILM: (to Camera) All right, put that away sonny.
   [He walks over to it and puts his hand over the lens.]
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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

--- 
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/d/optout.

Raspunde prin e-mail lui