summaryrefslogtreecommitdiff
path: root/ext/Safe
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-10-04 20:01:54 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-10-04 20:01:54 +0000
commitd00660f465786916fefe3ea27590f9ad4976afab (patch)
tree79bef81573f4f0480d80b32143c17347cf7763ae /ext/Safe
parent33f7e1aa9bf0173d92dc0c0b35d57754dbf6c87e (diff)
downloadperl-d00660f465786916fefe3ea27590f9ad4976afab.tar.gz
Complement to change #17976 :
there was a similar bug on rdo(). Increment $Safe::VERSION. p4raw-link: @17976 on //depot/perl: 33f7e1aa9bf0173d92dc0c0b35d57754dbf6c87e p4raw-id: //depot/perl@17977
Diffstat (limited to 'ext/Safe')
-rw-r--r--ext/Safe/safe3.t21
1 files changed, 18 insertions, 3 deletions
diff --git a/ext/Safe/safe3.t b/ext/Safe/safe3.t
index c924762faa..6265d146e3 100644
--- a/ext/Safe/safe3.t
+++ b/ext/Safe/safe3.t
@@ -18,16 +18,31 @@ BEGIN {
use strict;
use warnings;
use POSIX qw(ceil);
-use Test::More tests => 1;
+use Test::More tests => 2;
use Safe;
my $safe = new Safe;
$safe->deny('add');
+my $masksize = ceil( Opcode::opcodes / 8 );
# Attempt to change the opmask from within the safe compartment
-$safe->reval( qq{\$_[1] = q/\0/ x } . ceil( Opcode::opcodes / 8 ) );
+$safe->reval( qq{\$_[1] = qq/\0/ x } . $masksize );
# Check that it didn't work
$safe->reval( q{$x + $y} );
like( $@, qr/^'?addition \(\+\)'? trapped by operation mask/,
- 'opmask still in place' );
+ 'opmask still in place with reval' );
+
+my $safe2 = new Safe;
+$safe2->deny('add');
+
+open my $fh, '>nasty.pl' or die "Can't write nasty.pl: $!\n";
+print $fh <<EOF;
+\$_[1] = "\0" x $masksize;
+EOF
+close $fh;
+$safe2->rdo('nasty.pl');
+$safe2->reval( q{$x + $y} );
+like( $@, qr/^'?addition \(\+\)'? trapped by operation mask/,
+ 'opmask still in place with rdo' );
+END { unlink 'nasty.pl' }