From: Salvador Ortiz Garcia Date: Sun, 6 Sep 2009 21:41:57 +0000 (+0200) Subject: Corrupt filename when setting %INC entry in a @INC hook X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d8723a6a74b2c12e9d732728dbe717672ab893f2;p=p5sagit%2Fp5-mst-13.2.git Corrupt filename when setting %INC entry in a @INC hook The code in pp_ctl.c after calling an @INC hook blindly assumes that the SV setted by the user in %INC is an SVPV (SvPOK true) for setting the filename. So when the user uses other scalar types, the output of __FILE__, warn, die, caller, etc. shows random garbage. --- diff --git a/pp_ctl.c b/pp_ctl.c index 0eb513f..4cde9f8 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -3354,7 +3354,7 @@ PP(pp_require) /* Adjust file name if the hook has set an %INC entry */ svp = hv_fetch(GvHVn(PL_incgv), name, len, 0); if (svp) - tryname = SvPVX_const(*svp); + tryname = SvPV_nolen_const(*svp); if (count > 0) { int i = 0;