summaryrefslogtreecommitdiff
path: root/t/comp
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-08-04 23:52:20 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-08-05 02:23:32 -0700
commit1311cfc0a7b1bfcfd292948a7d88f0536e2e1c6e (patch)
treefe9d317395e79df6ab9877f3cd8e8e66aa5ab3f8 /t/comp
parentc82ecf346a8512f22f25188e450d92938c245421 (diff)
downloadperl-1311cfc0a7b1bfcfd292948a7d88f0536e2e1c6e.tar.gz
Prevent __FILE__ corruption when ${"_<..."} is modified
This fixes a longstanding bug under non-threaded builds that was extended to threaded builds by the previous commit. Modifying the SV slot of the file gv can cause CopFILE to violate memory discipline, giving random strings. Since the GV is named after the file, too, and since its name can- not be changed from Perl space, use that for CopFILE instead.
Diffstat (limited to 't/comp')
-rw-r--r--t/comp/parser.t7
1 files changed, 6 insertions, 1 deletions
diff --git a/t/comp/parser.t b/t/comp/parser.t
index 5f0d40734d..a9b044a518 100644
--- a/t/comp/parser.t
+++ b/t/comp/parser.t
@@ -8,7 +8,7 @@ BEGIN {
chdir 't';
}
-print "1..157\n";
+print "1..158\n";
sub failed {
my ($got, $expected, $name) = @_;
@@ -482,6 +482,11 @@ for(__PACKAGE__) {
is $_, 'main', '__PACKAGE__ is read-only';
}
+$file = __FILE__;
+BEGIN{ ${"_<".__FILE__} = \1 }
+is __FILE__, $file,
+ 'no __FILE__ corruption when setting CopFILESV to a ref';
+
# Add new tests HERE (above this line)
# bug #74022: Loop on characters in \p{OtherIDContinue}