summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2015-03-27 12:39:54 -0700
committerFather Chrysostomos <sprout@cpan.org>2015-03-27 12:39:54 -0700
commitd655d9a2c4d4884d0edf5364a3aafbc8b0b8de38 (patch)
tree8f220e1d560a599239718bcd84414bbf08ad79ce
parent71622e40793536aa4f2ace7ffc704cc78151fd26 (diff)
downloadperl-d655d9a2c4d4884d0edf5364a3aafbc8b0b8de38.tar.gz
[perl #124099] Wrong CvOUTSIDE in find_lexical_cv
Instead of following the chain of CvOUTSIDE pointers, I had it always looking at the CvOUTSIDE pointer of the current PL_compcv. So any time it had to dig down more than one level, it had a chance of crash- ing or looping.
-rw-r--r--op.c2
-rw-r--r--t/op/lexsub.t6
2 files changed, 7 insertions, 1 deletions
diff --git a/op.c b/op.c
index 89bf436969..3000c4481c 100644
--- a/op.c
+++ b/op.c
@@ -11238,7 +11238,7 @@ Perl_find_lexical_cv(pTHX_ PADOFFSET off)
CV *compcv = PL_compcv;
while (PadnameOUTER(name)) {
assert(PARENT_PAD_INDEX(name));
- compcv = CvOUTSIDE(PL_compcv);
+ compcv = CvOUTSIDE(compcv);
name = PadlistNAMESARRAY(CvPADLIST(compcv))
[off = PARENT_PAD_INDEX(name)];
}
diff --git a/t/op/lexsub.t b/t/op/lexsub.t
index b1b76e84c3..adccf4c5db 100644
--- a/t/op/lexsub.t
+++ b/t/op/lexsub.t
@@ -961,3 +961,9 @@ like runperl(
@AutoloadTest::ISA = AutoloadTestSuper::;
AutoloadTest->blah;
}
+
+# This used to crash because op.c:find_lexical_cv was looking at the wrong
+# CV’s OUTSIDE pointer. [perl #124099]
+{
+ my sub h; sub{my $x; sub{h}}
+}