summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-12-09 06:24:21 -0800
committerFather Chrysostomos <sprout@cpan.org>2014-12-09 06:24:36 -0800
commitc4c855b90ec42b2452daf44d4d9994afd1613089 (patch)
treef3af93eb31e12e2eaef6a0b8a4c846d18c30d354 /op.c
parent74a9453a18ff8c4f52f48455c0b4a622e295160a (diff)
downloadperl-c4c855b90ec42b2452daf44d4d9994afd1613089.tar.gz
op.c: Temporary fix for bad read
We can’t read *name at this point, because the SAVEFREEOP(o)/LEAVE_SCOPE above will have freed the SV owning the string buffer. We can’t do pad_add_weakref before LEAVE_SCOPE, because it will add the entry to the wrong pad. This fix is only temporary, because one more behaviour change (ena- bling read-only ops for special blocks other than BEGIN) will allow be to simplify it.
Diffstat (limited to 'op.c')
-rw-r--r--op.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/op.c b/op.c
index 043e83aa25..8cd24b0098 100644
--- a/op.c
+++ b/op.c
@@ -8450,6 +8450,7 @@ Perl_newATTRSUB_x(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs,
bool has_name;
bool name_is_utf8 = o && !o_is_gv && SvUTF8(cSVOPo->op_sv);
bool special = FALSE;
+ bool maybe_begin = FALSE;
OP *start;
#ifdef PERL_DEBUG_READONLY_OPS
OPSLAB *slab = NULL;
@@ -8856,8 +8857,11 @@ Perl_newATTRSUB_x(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs,
if (PL_parser && PL_parser->error_count)
clear_special_blocks(name, gv, cv);
else
+ {
+ maybe_begin = *name == 'B';
special =
process_special_blocks(floor, name, gv, cv);
+ }
}
}
@@ -8870,7 +8874,7 @@ Perl_newATTRSUB_x(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs,
if (!special && slab)
Slab_to_ro(slab);
#endif
- if (cv && name && (!special || *name != 'B') && CvOUTSIDE(cv)
+ if (cv && name && (!special || !maybe_begin) && CvOUTSIDE(cv)
&& !CvEVAL(CvOUTSIDE(cv)))
pad_add_weakref(cv);
return cv;