This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Handle non-PV $_ in @INC filters
authorFather Chrysostomos <sprout@cpan.org>
Thu, 8 Aug 2013 19:49:57 +0000 (12:49 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 11 Aug 2013 14:50:22 +0000 (07:50 -0700)
commitae2c96eda1df76d1bf5fba543a6ebfc266fdd824
treecbdeca63513779b49b644e710711cb595345527a
parent54ac81a4f8dd759b88b5a5104af99f6af2814215
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.
pp_ctl.c
t/op/incfilter.t