develooper Front page | perl.perl5.porters | Postings from March 2006

[perl #34349] SIGSEGV in S_regmatch

Thread Next
From:
Steve Peters via RT
Date:
March 30, 2006 18:42
Subject:
[perl #34349] SIGSEGV in S_regmatch
Message ID:
rt-3.0.11-34349-131748.2.93570384064886@perl.org
> [abigail@abigail.nl - Sat Mar 05 17:07:59 2005]:
> 
> 
> This is a bug report for perl from abigail@abigail.nl,
> generated with the help of perlbug 1.35 running under perl v5.8.6.
> 
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> 
> I've a program that does some screen scraping. It had been working
> fine for a few weeks, but today it started getting segmentation
> faults while doing a pattern match. I've been able to reproduce the
> problem in the following program:
> 
>     $_ = "<_>" . ("<" x 4_157) . "</_>";
>     my @matches = m{<\w+>([^<]*(?:<(?!/?\w)[^<]*)*)</\w+>}g;
> 
> Running this in gdb gives:
> 
>     Program received signal SIGSEGV, Segmentation fault.
>     0x08131623 in S_regmatch (prog=0x818e3e4) at regexec.c:2363
>     2363            switch (OP(scan)) {
> 
> Now, if I change the 4_157 to 4_156, the program runs fine.
> 
> Trying with older versions of Perl, it seems they all segfault, but
>    the
> the older the version of Perl is - the longer the string needs to be
> before it crashes.
> 
> Here's a table of versions of Perl, and the highest string I can use
> before the regexp causes a segfault:
> 
>      5.000: 32755
>   5.004_04: 23820
>   5.004_05: 23820
>      5.005: 16375
>   5.005_01: 16375
>   5.005_02: 16375
>   5.005_03: 16375
>   5.005_04: 16375
>      5.6.0:  6548
>      5.6.1:  6388
>      5.6.2:  6388
>      5.8.0:  4091
>      5.8.1:  4156
>      5.8.2:  4156
>      5.8.3:  4156
>      5.8.4:  4156
>      5.8.5:  4156
>      5.8.6:  4156
>      5.9.0:  4156
>      5.9.1:  4156
> 
> 
> Now I realize this hitting this limit is related to the maximum stack
> size on my system (ulimit gives 'unlimited'), and Perl can't take all
> the blame. But it is a concern that 5.000 can handle strings 8 times
>    as
> long as more modern Perls before hitting the same limit.
> 
> 

I'm not able to reproduce this in either 5.8.7 or a current blead.  Are you able to reproduce 
this problem still?

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