summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-08-08 12:49:57 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-08-11 07:50:22 -0700
commitae2c96eda1df76d1bf5fba543a6ebfc266fdd824 (patch)
treecbdeca63513779b49b644e710711cb595345527a /pp_ctl.c
parent54ac81a4f8dd759b88b5a5104af99f6af2814215 (diff)
downloadperl-ae2c96eda1df76d1bf5fba543a6ebfc266fdd824.tar.gz
Handle non-PV $_ in @INC filters
@INC filters (code refs returned by code refs in @INC) are given the current line of code in $_ and can modify it. The C code that invokes the Perl filter is in pp_ctl.c:S_run_user_filter. It was not taking into account that $_ might not have a PV pointer when it is returned, and so this could result in crashes or assertion failures. This commit forces the scalar to be a string before returning it to the lexer, unless it is undef. If we force it to be a string when it is undef, then existing tests start producing uninitialized warnings. The logic is still faulty in places. Subsequent commits will address that.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 85149fe2f3..aa11d58872 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -5506,6 +5506,7 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen)
(SvOK(upstream) || SvGMAGICAL(upstream))) {
sv_catsv(buf_sv, upstream);
}
+ else if (SvOK(upstream)) (void)SvPV_force_nolen(buf_sv);
if (status <= 0) {
IoLINES(datasv) = 0;