X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pp_hot.c;h=d907570e4c2929b2b4240e414d2d39aa58e33d15;hb=5cfbcfcdc45b1cdd758241f7f02495ded7acc722;hp=e407b7b47748f97681ef24594d6cf962dc0e3cc8;hpb=4bb101f2758f169969171dfe6b70f68a406dcc1e;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pp_hot.c b/pp_hot.c index e407b7b..d907570 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1859,6 +1859,12 @@ PP(pp_iter) else { sv = AvARRAY(av)[++cx->blk_loop.iterix]; } + if (sv && SvREFCNT(sv) == 0) { + *itersvp = Nullsv; + Perl_croak(aTHX_ + "Use of freed value in iteration (perhaps you modified the iterated array within the loop?)"); + } + if (sv) SvTEMP_off(sv); else @@ -2155,6 +2161,7 @@ PP(pp_subst) if (!c) { register PERL_CONTEXT *cx; SPAGAIN; + ReREFCNT_inc(rx); PUSHSUBST(cx); RETURNOP(cPMOP->op_pmreplroot); } @@ -2932,7 +2939,7 @@ S_method_common(pTHX_ SV* meth, U32* hashp) HE* he; he = hv_fetch_ent(PL_stashcache, sv, 0, 0); if (he) { - stash = (HV*)SvIV(HeVAL(he)); + stash = INT2PTR(HV*,SvIV(HeVAL(he))); goto fetch; } } @@ -2958,7 +2965,7 @@ S_method_common(pTHX_ SV* meth, U32* hashp) if (!stash) packsv = sv; else { - SV* ref = newSViv((IV)stash); + SV* ref = newSViv(PTR2IV(stash)); hv_store(PL_stashcache, packname, packlen, ref, 0); } goto fetch;