perl/perl-5.8.8-bug24254.patch
2007-10-18 17:18:38 +00:00

35 lines
1.4 KiB
Diff

diff -up perl-5.8.8/cop.h.BAD perl-5.8.8/cop.h
--- perl-5.8.8/cop.h.BAD 2007-10-18 09:54:16.000000000 -0400
+++ perl-5.8.8/cop.h 2007-10-18 09:56:17.000000000 -0400
@@ -286,9 +286,14 @@ struct block_loop {
#define POPLOOP(cx) \
SvREFCNT_dec(cx->blk_loop.iterlval); \
if (CxITERVAR(cx)) { \
- SV **s_v_p = CxITERVAR(cx); \
- sv_2mortal(*s_v_p); \
- *s_v_p = cx->blk_loop.itersave; \
+ if (SvPADMY(cx->blk_loop.itersave)) { \
+ SV **s_v_p = CxITERVAR(cx); \
+ sv_2mortal(*s_v_p); \
+ *s_v_p = cx->blk_loop.itersave; \
+ } \
+ else { \
+ SvREFCNT_dec(cx->blk_loop.itersave); \
+ } \
} \
if (cx->blk_loop.iterary && cx->blk_loop.iterary != PL_curstack)\
SvREFCNT_dec(cx->blk_loop.iterary);
diff -up perl-5.8.8/t/op/local.t.BAD perl-5.8.8/t/op/local.t
--- perl-5.8.8/t/op/local.t.BAD 2007-10-18 10:53:10.000000000 -0400
+++ perl-5.8.8/t/op/local.t 2007-10-18 10:53:44.000000000 -0400
@@ -324,7 +324,7 @@ like($@, qr/Modification of a read-only
# make sure $1 is still read-only
eval { for ($1) { local $_ = 1 } };
-is($@, "");
+like($@, qr/Modification of a read-only value attempted/);
# The s/// adds 'g' magic to $_, but it should remain non-readonly
eval { for("a") { for $x (1,2) { local $_="b"; s/(.*)/+$1/ } } };
diff -up perl-5.8.8/op.c.BAD perl-5.8.8/op.c