Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the YAML CPAN distribution.

Report information
The Basics
Id: 18195
Status: resolved
Priority: 0/
Queue: YAML

People
Owner: Nobody in particular
Requestors: mramberg [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.58
Fixed in: (no value)



Subject: YAML segfaults loading file it wrote
marcus@ds1:~/src/Horus-Search/script$ perl -MYAML -le'$f=YAML::LoadFile(qq{/tmp/horus-export.yml})' Segmentation fault And here's the files: http://ds1.startsiden.no/horus-export.yml http://ds1.startsiden.no/yaml-trace
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #18195] YAML segfaults loading file it wrote
Date: Thu, 16 Mar 2006 03:23:40 -0800
To: via RT <bug-YAML [...] rt.cpan.org>
From: ingy [...] ttul.org (Ingy dot Net)
Any chance you could divide and conquer that file at least a bit. I'm pretty sure that's not the smallest the file could be. Thanks, Ingy On 16/03/06 06:14 -0500, via RT wrote: Show quoted text
> > Thu Mar 16 06:14:17 2006: Request 18195 was acted upon. > Transaction: Ticket created by MRAMBERG > Queue: YAML > Subject: YAML segfaults loading file it wrote > Owner: Nobody > Requestors: MRAMBERG@cpan.org > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=18195 > > > > marcus@ds1:~/src/Horus-Search/script$ perl -MYAML > -le'$f=YAML::LoadFile(qq{/tmp/horus-export.yml})' > Segmentation fault > > And here's the files: > > http://ds1.startsiden.no/horus-export.yml > http://ds1.startsiden.no/yaml-trace
Subject: Re: [rt.cpan.org #18195] YAML segfaults loading file it wrote
Date: Sun, 19 Mar 2006 00:45:01 +0100
To: bug-YAML [...] rt.cpan.org
From: "Marcus Ramberg" <marcus [...] thefeed.no>
I already finished the script by changing it not to persist to disk before transfering to a new database, and I don't have the original. :/ On 3/16/06, Brian Ingerson via RT <bug-YAML@rt.cpan.org> wrote: Show quoted text
> > > <URL: http://rt.cpan.org/Ticket/Display.html?id=18195 > > > Any chance you could divide and conquer that file at least a bit. > > I'm pretty sure that's not the smallest the file could be. > > Thanks, Ingy > > On 16/03/06 06:14 -0500, via RT wrote:
> > > > Thu Mar 16 06:14:17 2006: Request 18195 was acted upon. > > Transaction: Ticket created by MRAMBERG > > Queue: YAML > > Subject: YAML segfaults loading file it wrote > > Owner: Nobody > > Requestors: MRAMBERG@cpan.org > > Status: new > > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=18195 > > > > > > > marcus@ds1:~/src/Horus-Search/script$ perl -MYAML > > -le'$f=YAML::LoadFile(qq{/tmp/horus-export.yml})' > > Segmentation fault > > > > And here's the files: > > > > http://ds1.startsiden.no/horus-export.yml > > http://ds1.startsiden.no/yaml-trace
> >
-- With regards Marcus Ramberg
From: Andy Bach (perlbones [...] gmail.com)
Just a data point - tested it here (Sol x86, perl 5.8.0 YAML .58) and got no seg fault. Did notice some very, very long lines in the data: $. length 2789 4203 2738 4314 2739 4926 2790 5038 2687 5945 2688 6809 So maybe that's the issue? a
From: Krzysztof Leszczynski <chris [...] camk.edu.pl>
On Czw. 16 Mar. 2006, 06:24:00, ingy@ttul.org wrote: Show quoted text
> Any chance you could divide and conquer that file at least a bit. > > I'm pretty sure that's not the smallest the file could be. > > Thanks, Ingy
Ingy, this is bug in Perl, not in YAML. See perl-porters bug #39167. The problem is in YAML.pm:1271 line: if ($o->{inline} =~ /^"((?:\\"|[^"])*)"\s*(.*)$/) { Try to run: #! /usr/bin/perl $_ = '"' . ( "a" x 50_000) . '"'; /^"((?:\\"|[^"])*)"\s*(.*)$/ See this regexp? It segfaults the perl interpreter (and mod_perl, and httpd and ayayayay!) According to Dominic Dunlop, this will be fixed in perl 5.10.x, meanwhile I think making things more iterative, like puting chunks in @list and join("",)-ing it together would help. Cheers Krzysio Leszczynski PS. Here's a patch I made to YAML.pm, that make a silly work-around. diff -u o/YAML.pm YAML.pm --- o/YAML.pm 2006-05-20 08:49:43.000000000 +0200 +++ YAML.pm 2006-05-20 10:02:44.000000000 +0200 @@ -1266,9 +1266,24 @@ return $node; } +# Work around /regexp/ bug in perl < 5.10 +sub _parse_inline_double_quoted_perl_bug_work_around { + my @list; + local $_=$o->{inline}; + s{^"}{} or croak YAML_PARSE_ERR_BAD_DOUBLE(); + push @list, $1 + while s{^((?:\\.|[^\"\\]+){1,1000})}{}; + s/\\"/"/g for @list; + s{^"}{} or croak YAML_PARSE_ERR_BAD_DOUBLE(); + $o->{inline} = $_; + return join("",@list); +} + # Parse the inline double quoted string. sub _parse_inline_double_quoted { my $node; + return _parse_inline_double_quoted_perl_bug_work_around(@_) + if $]<5.009 && length($o->{inline}) > 10_000; if ($o->{inline} =~ /^"((?:\\"|[^"])*)"\s*(.*)$/) { $node = $1; $o->{inline} = $2;
Hi there, I managed to create a fix. You can check it out here: https://rt.cpan.org/Ticket/Display.html?id=90593 Greetings, Thorsten
Subject: Re: [rt.cpan.org #18195] YAML segfaults loading file it wrote
Date: Fri, 22 Nov 2013 11:57:03 -0800
To: bug-YAML [...] rt.cpan.org
From: Ingy dot Net <ingy [...] ingy.net>
Thanks! You may wish to join #yaml on irc.perl.org. On Fri, Nov 22, 2013 at 3:42 AM, Thorsten Eckel via RT <bug-YAML@rt.cpan.org Show quoted text
> wrote:
Show quoted text
> Queue: YAML > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=18195 > > > Hi there, > > I managed to create a fix. > > You can check it out here: > https://rt.cpan.org/Ticket/Display.html?id=90593 > > Greetings, Thorsten >
Fixed in 0.85