diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-06-26 09:23:06 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-06-26 09:23:06 -0700 |
commit | 0f9db002b9f34078759729fa70bd1d6fb2350fb8 (patch) | |
tree | c9a1a34cf1ebc9081cd325e1b16f36c69b3fee10 /MANIFEST | |
parent | 0421bbaac46a223a26370e5607f294edc7e77c98 (diff) | |
download | perl-0f9db002b9f34078759729fa70bd1d6fb2350fb8.tar.gz |
[perl #113812] Handle null CvOUTSIDE in cv_clone
Commit a0d2bbd stopped closures from hanging on to their
enclosing subs.
This means that the outer sub can be freed before the closure. Since
it is only the outer sub that references the closure prototype (in a
'&' entry in its pad), when the outer sub is freed the closure proto-
type goes with it. Now if that closure itself contains a closure
(more precisely, a closure prototype in its pad, referenced by an
anoncode op), that inner closure prototype’s CvOUTSIDE points to the
first closure prototype. When that first closure prototype is freed
the innermost closure prototype has its CvOUTSIDE set to whatever the
outermost sub’s CvOUTSIDE was set to, which could be null if it is
in its own file. So when the first closure is called, it passes to
cv_clone a closure prototype with no CvOUTSIDE.
cv_clone used to crash if CvOUTSIDE was null.
Example:
$ cat foo.pl
# the main CV of the file is the outer sub in this case
my $x
$first_closure = sub {
$inner_closure = sub { $x }
}
$ perl -e 'require "./foo.pl"; $first_closure->()'
Bus error
This commit makes it use find_runcv when CvOUTSIDE is null.
Diffstat (limited to 'MANIFEST')
-rw-r--r-- | MANIFEST | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -5191,6 +5191,7 @@ t/op/chdir.t See if chdir works t/op/chop.t See if chop works t/op/chr.t See if chr works t/op/closure.t See if closures work +t/op/closure_test.pl Extra file for closure.t t/op/cmp.t See if the various string and numeric compare work t/op/concat2.t Tests too complex for concat.t t/op/concat.t See if string concatenation works |