in reply to Challenge, try to fix the bug
I'm having a hard time with it. I've narrowed down, I think, the crash to this regex in Template::Parser:
But what's odd is that if I eliminate all of Template Toolkit, and just use that while loop in my main script, no seg fault. What's even more curious is that if I leave that while in there and then run process, then there's still no segfault. I thought that maybe it's leaving the \G marker or something around, but even assigning to pos($text) doesn't reintroduce the segfault.while ($text =~ s/ ^(.*?) # $1 - start of line up to directive (?: $start # start of tag (.*?) # $2 - tag contents $end # end of tag ) //sx) {
This script works (rather, it doesn't segfault), and leaves me more confused than when I started.#!/usr/bin/perl use strict; use warnings; use Template; #use Template::Parser; my $template = Template->new({}); my $text = "[% SET content='" . ("stuff "x20_000) . "' %]"; my $start = qr/\Q[%/; my $end = qr/\Q%]/; while ($text =~ s/ ^(.*?) # $1 - start of line up to directive (?: $start # start of tag (.*?) # $2 - tag contents $end # end of tag ) //sx) { #print "1=$1\n2=$2\n"; } pos($text) = 0; $template->process(\$text, {}); print "Processed\n";
(Perl 5.8.8 here)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Challenge, try to fix the bug
by tilly (Archbishop) on Oct 21, 2009 at 15:47 UTC |