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

[perl #21922] regexp segfault

From:
Steve Peters via RT
Date:
March 30, 2006 19:17
Subject:
[perl #21922] regexp segfault
Message ID:
rt-3.0.11-21922-131752.12.7192346014296@perl.org
> [powerman@sky.net.ua - Wed Apr 09 18:44:49 2003]:
> 
> 
> This is a bug report for perl from powerman@sky.net.ua,
> generated with the help of perlbug 1.34 running under perl v5.8.0.
> 
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> 
> 
> $ perl -e '$_ = " " x 50000; /(?:  |)*/'
> Segmentation fault
> $ perl -e '$_ = " " x 50000; /(?:  |a)*/'
> Segmentation fault
> $ perl -e '$_ = " " x 50000; /(?: |aa)*/'
> Segmentation fault
> $ perl -e '$_ = " " x 50000; /(?:aa|[^a])*/'
> Segmentation fault
> $ perl -e '$_ = " " x 50000; /(?:ab|[^c])*/'
> Segmentation fault
> 
> There a lot of other regexps like these which also die by segfault
> if string is long enough (usually string should be >4100 bytes,
> but critical string size depend on environment [perl binary?]).
> 
> I've tested this bug on perl 5.8.0 and 5.6.1.
> 
> I've extracted these simple examples from very very big regexp.
> And I don't really understand what and why happens.
> 
> 

This has been fixed with change #27598.

steve@kirk:~/smoke/perl-current$ perl -e '$_ = " " x 50000; /(?:  |)*/'
Segmentation fault
steve@kirk:~/smoke/perl-current$ perl -e '$_ = " " x 50000; /(?:  |a)*/'
Segmentation fault
steve@kirk:~/smoke/perl-current$ perl -e '$_ = " " x 50000; /(?: |aa)*/'
Segmentation fault
steve@kirk:~/smoke/perl-current$ perl -e '$_ = " " x 50000; /(?:aa|[^a])*/'
Segmentation fault
steve@kirk:~/smoke/perl-current$ perl -e '$_ = " " x 50000; /(?:ab|[^c])*/'
Segmentation fault
steve@kirk:~/smoke/perl-current$ ./perl -e '$_ = " " x 50000; /(?:  |)*/'
steve@kirk:~/smoke/perl-current$ ./perl -e '$_ = " " x 50000; /(?:  |a)*/'
steve@kirk:~/smoke/perl-current$ ./perl -e '$_ = " " x 50000; /(?: |aa)*/'
steve@kirk:~/smoke/perl-current$ ./perl -e '$_ = " " x 50000; /(?:aa|[^a])*/'
steve@kirk:~/smoke/perl-current$ ./perl -e '$_ = " " x 50000; /(?:ab|[^c])*/'



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