diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-08-05 12:15:18 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-08-05 16:02:16 -0700 |
commit | ee23553f1b79f6259f9464480592b43a0c56e745 (patch) | |
tree | c7605a6a6b346c9930ec2c9f8963d693dd72aa39 /t/op/write.t | |
parent | d3810ef8d372a8c7b72ce050c1baa05f368045e6 (diff) | |
download | perl-ee23553f1b79f6259f9464480592b43a0c56e745.tar.gz |
Don’t let active formats be freed
This crashes:
format FOO =
@<
undef *FOO
.
$~ = FOO;
write
The context stack needs to hold a reference count for formats, just as
it does for subs.
Diffstat (limited to 't/op/write.t')
-rw-r--r-- | t/op/write.t | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/t/op/write.t b/t/op/write.t index 29b5b8a310..6c16191878 100644 --- a/t/op/write.t +++ b/t/op/write.t @@ -61,7 +61,7 @@ for my $tref ( @NumTests ){ my $bas_tests = 20; # number of tests in section 3 -my $bug_tests = 8 + 3 * 3 * 5 * 2 * 3 + 2 + 66 + 4 + 2 + 3 + 96; +my $bug_tests = 8 + 3 * 3 * 5 * 2 * 3 + 2 + 66 + 4 + 2 + 3 + 96 + 1; # number of tests in section 4 my $hmb_tests = 35; @@ -984,6 +984,17 @@ return close RT73690_2 or die "Could not close: $!"; })[0]; +open(UNDEF, '>Op_write.tmp') || die "Can't create Op_write.tmp"; +select +(select(UNDEF), $~ = "UNDEFFORMAT")[0]; +format UNDEFFORMAT = +@ +undef *UNDEFFORMAT +. +write UNDEF; +pass "active format cannot be freed"; +close UNDEF or die "Could not close: $!"; + + ############################# ## Section 4 ## Add new tests *above* here |