develooper Front page | perl.perl5.porters | Postings from May 2013

[perl #117917] Bug in Regex-Engine (?)

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
May 9, 2013 01:14
Subject:
[perl #117917] Bug in Regex-Engine (?)
Message ID:
rt-3.6.HEAD-6955-1368062085-1545.117917-15-0@perl.org
On Wed May 08 13:36:33 2013, kochnorman@rocketmail.com wrote:
> I am not sure, whether perlbug correctly sent this or not. Sorry, if 
> this is duplicate content to you.
> 
> The attached file is the bugreport, that I (hope) I just sent. If so, 
> ignore this mail please.
> 
> 

The program as I have extracted it from your attachment:

#####
$ cat 117917_regex.pl 
use strict;
use warnings;

use re "debugcolor"; 

sub getDel {
          my $z = shift;
          die $z;
          return ')' if $z eq '(';
          return '>' if $z eq '<';
          return ']' if $z eq '[';
          return '}' if $z eq '{';
          return $z;
} 

'qq"hello"' =~ /(?<stringstart>(?:q(?:[xwrq])?\s*)?)(?<delim>(??{
(exists ($+{stringstart}) && $+{stringstart} =~ m#q#) ? q#"|'# : '\\w'
})).*?(?<!\\)(??{ die $+{delim}; defined $1 ? quotemeta(getDel($1)) :
'(?!)' })/
#####

When I run this with 'use re "debugcolor";' commented out, I get this:

#####
$ perl 117917_regex.pl 
Use of uninitialized value $+{"delim"} in die at (re_eval 2) line 1.
Died at (re_eval 2) line 1.
#####

When I activate 'use re "debugcolor";', the program ends with a bus
error (see attachment).

Now, I have never actually used named captures in regular expressions,
nor have I ever used 'use re' anything.  So I can't claim to say
anything about the possible interaction of these features.

But if this were my program I'd deal *first* with the warning and error
message thrown when you run without 'debugcolor'.  I would then try to
build up the pattern match in small pieces, with and without
'debugcolor'.  The objective would be to determine what tips the program
into a segfault or bus error.

I don't see any evidence yet that there is a problem with the Perl 5
core distribution, which is the subject of this mailing list.  You might
be better off taking this problem first to a place such as
perlmonks.org.  If discussion there points to the Perl 5 regex engine as
the problem -- as distinct from use of that engine -- then we could
resume discussion here.

My two cents.

Thank you very much.
Jim Keenan


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

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