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

[perl #3634] Capture corruption through self-modying regexp (?{...})

Thread Next
From:
Father Chrysostomos via RT
Date:
July 27, 2013 14:05
Subject:
[perl #3634] Capture corruption through self-modying regexp (?{...})
Message ID:
rt-3.6.HEAD-8947-1374933938-1000.3634-15-0@perl.org
On Thu Jun 14 15:13:18 2012, davem wrote:
> On Thu, Jun 14, 2012 at 09:48:34AM -0700, Father Chrysostomos via RT
wrote:
> > On Thu Aug 03 18:02:21 2000, jfriedl@yahoo-inc.com wrote:
> > > 
> > >     #!/usr/local/bin/perl -w
> > >     use strict;
> > > 
> > >     my $text = "a";
> > >     $text =~ m/(.(?{ $text .= "x" }))*/;
> > > 
> > >     print "text is [$text]\n";
> > >     print "length of text: ", length($text), "\n";
> > >     print "starts: ", join('|', @-), "\n";
> > >     print "ends  : ", join('|', @-), "\n";
> > >     printf("length of match parts: [%d|%d|%d]\n", length($`),
> > > length($&), length($'));
> > >     printf("match itself: [%s|%s|%s]\n", map { defined($_) ? $_ : 'X'}
> > > $`, $&, $');
> > >     print "\$1[$1]\n";
> > > 
> > > prints (when piped through cat -v):
> > > 
> > >     text is [axxxxxxxxx]
> > >     length of text: 10
> > >     starts: 0|7
> > >     ends  : 0|7
> > >     length of match parts: [0|8|0]
> > >     match itself: [|a^@^X@M-hd^O^H|X]
> > >     $1[^H]
> > 
> > This is still a problem in bleadperl (c8d84f8c67a), even after Dave
> > Mitchell’s jumbo re-eval rewrite.
> 
> Yep, that's the one ticket in the metaticket that's not fixed yet.

This appears to be fixed now, and I suspect it is because of
PERL_NEW_COPY_ON_WRITE (meaning the bug is still present under
-Accflags=-DPERL_NO_COW), but I haven’t checked.

-- 

Father Chrysostomos


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

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