develooper Front page | perl.perl5.porters | Postings from April 2012

[perl #112608] panic: sv_setpvn called with negative strlen -1

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
April 25, 2012 20:38
Subject:
[perl #112608] panic: sv_setpvn called with negative strlen -1
Message ID:
rt-3.6.HEAD-4610-1335411484-40.112608-15-0@perl.org
On Wed Apr 25 19:58:59 2012, public@khwilliamson.com wrote:
> On 04/25/2012 05:15 AM, Leon Timmermans wrote:
> > 2012/4/25 Steve Hay<perlbug-followup@perl.org>:
> >> Running the program below with the attached utf8.txt input file
produces
> >> the following crash:
> >> panic: sv_setpvn called with negative strlen -1 at utf8.pl line 4,<$rh>
> >> line 28.
> >> Close with partial character at utf8.pl line 4,<$rh>  line 28.
> >>
> >> open my $rh, '<:encoding(UTF-8)', 'utf8.txt' or die $!;
> >> open my $wh, '>:encoding(ISO-8859-1)', 'iso88591.txt' or die $!;
> >> #select((select($wh), $| = 1)[0]);
> >> print $wh $_ while<$rh>;
> >> close $wh;
> >> close $rh;
> >>
> >> Obviously the (Greek) characters in the input file cannot be converted
> >> to ISO-8859-1, but perl shouldn't crash.
> >
> > This crash only seems to happen when combining :crlf with :encoding. I
> > suspect we need a smaller test-case to make it obvious what's really
> > happening.
> >
> >> Uncommenting the select() call strangely makes the crash go away. So
> >> does deleting any single line from the input file.
> >
> > Another thing that makes it go away: removing the byte order mark in
> > your file. This is smelling fishy.
> >
> > Leon
> >
> 
> I could not get this to reproduce on my machine with blead.  Instead, I 
> get messages like:
>    \x{feff}" does not map to iso-8859-1 at test.pl line 4, <$rh> line 28.
>   "\x{039f}" does not map to iso-8859-1 at test.pl line 4, <$rh> line 28.
>   "\x{03af}" does not map to iso-8859-1 at test.pl line 4, <$rh> line 28.
>   "\x{03a3}" does not map to iso-8859-1 at test.pl line 4, <$rh> line 28.
>   "\x{03c5}" does not map to iso-8859-1 at test.pl line 4, <$rh> line 28.
>   "\x{03bd}" does not map to iso-8859-1 at test.pl line 4, <$rh> line 28.
> ...
>   "\x{03cd}" does not map to iso-8859-1 at test.pl line 5, <$rh> line 28.
>   "\x{03b6}" does not map to iso-8859-1 at test.pl line 5, <$rh> line 28.
>   "\x{03b5}" does not map to iso-8859-1 at test.pl line 5, <$rh> line 28.
>   "\x{03b9}" does not map to iso-8859-1 at test.pl line 5, <$rh> line 28.
> 

I get the same result on a Mac, both threaded and unthreaded.

A C backtrace would help.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=112608

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About