Skip Menu |

This queue is for tickets about the Safe CPAN distribution.

Report information
The Basics
Id: 49399
Status: new
Priority: 0/
Queue: Safe

People
Owner: RGARCIA [...] cpan.org
Requestors: dam [...] modsoftsys.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.19
Fixed in: (no value)



Subject: strange behaviour with (?{ CODE }) in regex if CODE uses a restricted OP
Hi, Trying to use a very restricted safe compartment for evaluating distrusted substitutions, but it misbehaves when (?{..}) is in the regex. Consider the following example: ------------------------------- use Safe; my $re = q,s/(?{ $f=1 })a/b/,; my $s = Safe->new; $s->permit_only(qw(subst padany lineseq const rv2sv pushmark list leaveeval concat)); $_='a'; $s->reval($re); print "Lives\n"; die $@ if $@; -------------------------------- $ perl test.pl $ echo $? 0 $ Note no "Lives" is printed. It seems the script exit(0)s at the reval call. Permitting sassign (scalar assignment) makes it run, but I'd like to have this restricted. Replacing $f=1 with simple 'warn' makes it run only if 'warn' is in the permitted OPs, otherwise it exit(0)s again. Problem also reproducible with Safe 2.12 (from Perl 5.10.0 core). Thanks for considering, Damyan