FAQ

On Thu May 17 06:08:35 2007, merijnb <!-- x --> at iloquent.nl wrote:

This is a bug report for perl from merijnb <!-- x --> at iloquent.nl,
generated with the help of perlbug 1.35 running under perl v5.8.8.


-----------------------------------------------------------------
[Please enter your report here]

Hello,

The following program causes a segfault for Perl:

#!/usr/bin/perl -w
use strict;
use Text::ParseWords;
# Generates a line '"Section One","01234567890123456789..."'
my $line = '"Section One","' . '0123456789' x ($ARGV[0] || 3200) .
'"';
print "Length line: " . length($line) . "\n";
my @fields = &quotewords(',', 0, $line) or die "Cannot quotewords:
$!\n";
print map {"$_\n"} @fields;

If the string gets too long the regexp in parse_line blows the stack.
Since
this is a core module I think it would be good to optimize the regexp.
Fortunately, though, this sort of stack blowing regexp has been fixed in
bleadperl. The testcase above does not SEGV, and actually runs rather
quickly.

Thanks for the report!

Search Discussions

  • Nicholas Clark at Jul 25, 2007 at 3:52 pm

    On Wed, Jul 25, 2007 at 08:46:09AM -0700, Steve Peters via RT wrote:
    On Thu May 17 06:08:35 2007, merijnb <!-- x --> at iloquent.nl wrote:

    If the string gets too long the regexp in parse_line blows the stack.
    Since
    this is a core module I think it would be good to optimize the regexp.
    Fortunately, though, this sort of stack blowing regexp has been fixed in
    bleadperl. The testcase above does not SEGV, and actually runs rather
    quickly.

    Thanks for the report!
    It would be good to fix the regexp, as the regexp fix won't be in future
    5.8.x, but Text::ParseWords will.

    Nicholas Clark
  • Demerphq at Jul 26, 2007 at 12:24 am

    On 7/25/07, Nicholas Clark wrote:
    On Wed, Jul 25, 2007 at 08:46:09AM -0700, Steve Peters via RT wrote:
    On Thu May 17 06:08:35 2007, merijnb <!-- x --> at iloquent.nl wrote:

    If the string gets too long the regexp in parse_line blows the stack.
    Since
    this is a core module I think it would be good to optimize the regexp.
    Fortunately, though, this sort of stack blowing regexp has been fixed in
    bleadperl. The testcase above does not SEGV, and actually runs rather
    quickly.

    Thanks for the report!
    It would be good to fix the regexp, as the regexp fix won't be in future
    5.8.x, but Text::ParseWords will.
    Applied to blead as 31659

    http://public.activestate.com/cgi-bin/perlbrowse/p/31659

    Tested on 5.8.6 as well. As i note in the change log:

    This makes of the (?>...) construct in the regex engine making
    Text::ParseWords not backwards compatible with Perls from before the
    time this construct was added.


    --
    perl -Mre=debug -e "/just|another|perl|hacker/"

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl5-porters @
categoriesperl
postedJul 25, '07 at 3:46p
activeJul 26, '07 at 12:24a
posts3
users3
websiteperl.org

People

Translate

site design / logo © 2022 Grokbase