develooper Front page | perl.perl5.porters | Postings from June 2012

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

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
June 14, 2012 09:48
Subject:
[perl #3634] Capture corruption through self-modying regexp (?{...})
Message ID:
rt-3.6.HEAD-5009-1339692513-711.3634-15-0@perl.org
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.

$ pbpaste|./perl -Ilib
text is [axxxxxxxxx]
length of text: 10
starts: 0|7
ends : 0|7
Assertion failed: (rx->sublen >= (s - rx->subbeg) + i), function
Perl_reg_numbered_buff_fetch, file regcomp.c, line 6696.
Abort trap

-- 

Father Chrysostomos


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

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