summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-11-23 20:26:51 -0800
committerFather Chrysostomos <sprout@cpan.org>2011-11-24 01:45:30 -0800
commite37d6bdb385bdcf32a72bdde366106ee4c503bfe (patch)
treee822a49d3102560178721d892a61d7d25a4b0b03 /sv.c
parent9d6d5a7950f47e97191ed3cc7a45cd5b06163193 (diff)
downloadperl-e37d6bdb385bdcf32a72bdde366106ee4c503bfe.tar.gz
sysread should not ignore magic on its buffer
sysread uses SvPV_force, which has a bug in it. Even if the SV_GMAGIC flag is passed to sv_pvn_force_flags (which SvPV_force does), it ignores magic in any typeglob argument.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sv.c b/sv.c
index b8f0b100f5..31bda3b2d3 100644
--- a/sv.c
+++ b/sv.c
@@ -9014,6 +9014,7 @@ Perl_sv_pvn_force_flags(pTHX_ SV *const sv, STRLEN *const lp, const I32 flags)
PERL_ARGS_ASSERT_SV_PVN_FORCE_FLAGS;
+ if (flags & SV_GMAGIC) SvGETMAGIC(sv);
if (SvTHINKFIRST(sv) && !SvROK(sv))
sv_force_normal_flags(sv, 0);
@@ -9038,7 +9039,7 @@ Perl_sv_pvn_force_flags(pTHX_ SV *const sv, STRLEN *const lp, const I32 flags)
/* diag_listed_as: Can't coerce %s to %s in %s */
Perl_croak(aTHX_ "Can't coerce %s to string in %s", sv_reftype(sv,0),
OP_DESC(PL_op));
- s = sv_2pv_flags(sv, &len, flags);
+ s = sv_2pv_flags(sv, &len, flags &~ SV_GMAGIC);
if (lp)
*lp = len;