diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-08-09 08:42:32 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-08-11 07:50:22 -0700 |
commit | 536ac391fe10ec8bed2037ca93dd5044c83eac16 (patch) | |
tree | 04aa28ae554fbc7be4063531ed42b00628b07b0a /pp_ctl.c | |
parent | ae2c96eda1df76d1bf5fba543a6ebfc266fdd824 (diff) | |
download | perl-536ac391fe10ec8bed2037ca93dd5044c83eac16.tar.gz |
Tying $_ in @INC filter
Crazy? Probably. But the existing code partially handles magic val-
ues already; it’s just buggy. Also, the magic value could come from
another source filter that is not registered via @INC, and this is one
way to test that code path.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -5458,9 +5458,13 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen) LEAVE_with_name("call_filter_sub"); } + if (SvGMAGICAL(upstream)) { + mg_get(upstream); + if (upstream == buf_sv) mg_free(buf_sv); + } if (SvIsCOW(upstream)) sv_force_normal(upstream); if(!err && SvOK(upstream)) { - got_p = SvPV(upstream, got_len); + got_p = SvPV_nomg(upstream, got_len); if (umaxlen) { if (got_len > umaxlen) { prune_from = got_p + umaxlen; @@ -5504,7 +5508,7 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen) */ if (!err && upstream != buf_sv && (SvOK(upstream) || SvGMAGICAL(upstream))) { - sv_catsv(buf_sv, upstream); + sv_catsv_nomg(buf_sv, upstream); } else if (SvOK(upstream)) (void)SvPV_force_nolen(buf_sv); |