Change 29986 by [EMAIL PROTECTED] on 2007/01/25 23:07:41
Integrate:
[ 28251]
[perl #32332] Perl segfaults; test case available
sub f { s/$var/f()/e } could free the wrong RE
[ 28254]
eval { s/$foo/die/e } leaked a scalar
Affected files ...
... //depot/maint-5.8/perl/cop.h#31 integrate
... //depot/maint-5.8/perl/pp_ctl.c#160 integrate
... //depot/maint-5.8/perl/pp_hot.c#122 integrate
Differences ...
==== //depot/maint-5.8/perl/cop.h#31 (text) ====
Index: perl/cop.h
--- perl/cop.h#30~29967~ 2007-01-25 02:34:50.000000000 -0800
+++ perl/cop.h 2007-01-25 15:07:41.000000000 -0800
@@ -415,10 +415,12 @@
cx->sb_rxres = NULL, \
cx->sb_rx = rx, \
cx->cx_type = CXt_SUBST; \
- rxres_save(&cx->sb_rxres, rx)
+ rxres_save(&cx->sb_rxres, rx); \
+ ReREFCNT_inc(rx)
#define POPSUBST(cx) cx = &cxstack[cxstack_ix--]; \
- rxres_free(&cx->sb_rxres)
+ rxres_free(&cx->sb_rxres); \
+ ReREFCNT_dec(cx->sb_rx)
struct context {
U32 cx_type; /* what kind of context this is */
==== //depot/maint-5.8/perl/pp_ctl.c#160 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c#159~29984~ 2007-01-25 14:41:11.000000000 -0800
+++ perl/pp_ctl.c 2007-01-25 15:07:41.000000000 -0800
@@ -166,7 +166,7 @@
if(old != rx) {
if(old)
ReREFCNT_dec(old);
- PM_SETRE(pm,rx);
+ PM_SETRE(pm,ReREFCNT_inc(rx));
}
rxres_restore(&cx->sb_rxres, rx);
@@ -207,7 +207,6 @@
if (DO_UTF8(dstr))
SvUTF8_on(targ);
SvPV_set(dstr, NULL);
- sv_free(dstr);
TAINT_IF(cx->sb_rxtainted & 1);
PUSHs(sv_2mortal(newSViv(saviters - 1)));
@@ -218,7 +217,6 @@
SvTAINT(targ);
LEAVE_SCOPE(cx->sb_oldsave);
- ReREFCNT_dec(rx);
POPSUBST(cx);
RETURNOP(pm->op_next);
}
==== //depot/maint-5.8/perl/pp_hot.c#122 (text) ====
Index: perl/pp_hot.c
--- perl/pp_hot.c#121~29964~ 2007-01-24 15:53:28.000000000 -0800
+++ perl/pp_hot.c 2007-01-25 15:07:41.000000000 -0800
@@ -2267,13 +2267,13 @@
}
rxtainted |= RX_MATCH_TAINTED(rx);
dstr = newSVpvn(m, s-m);
+ SAVEFREESV(dstr);
if (DO_UTF8(TARG))
SvUTF8_on(dstr);
PL_curpm = pm;
if (!c) {
register PERL_CONTEXT *cx;
SPAGAIN;
- (void)ReREFCNT_inc(rx);
PUSHSUBST(cx);
RETURNOP(cPMOP->op_pmreplroot);
}
@@ -2312,7 +2312,6 @@
SvLEN_set(TARG, SvLEN(dstr));
doutf8 |= DO_UTF8(dstr);
SvPV_set(dstr, NULL);
- sv_free(dstr);
TAINT_IF(rxtainted & 1);
SPAGAIN;
End of Patch.