diff options
author | David Mitchell <davem@iabyn.com> | 2017-12-19 14:52:49 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2017-12-19 15:15:02 +0000 |
commit | 5e501dc57f49d52e0f2a302181be287457c0b736 (patch) | |
tree | 456a97ff9eaf94ad1ed0f7aee374edb97399ce97 /pp_hot.c | |
parent | c352ee5f96ca31651e1bac4e2f72702d961e700c (diff) | |
download | perl-5e501dc57f49d52e0f2a302181be287457c0b736.tar.gz |
avoid tainting boolean return value of s///
RT #132385
s/// normally returns an integer count, but sometimes for efficiency it
will return a boolean instead (PL_sv_yes/PL_sv_zero).
In these cases, don't try to taint the return value, since it will die
with 'Modification of a read-only value'.
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -4190,8 +4190,8 @@ PP(pp_subst) (SvTAINTED(TARG) ? SUBST_TAINT_STR : 0) | (RXp_ISTAINTED(prog) ? SUBST_TAINT_PAT : 0) | ((pm->op_pmflags & PMf_RETAINT) ? SUBST_TAINT_RETAINT : 0) - | ((once && !(rpm->op_pmflags & PMf_NONDESTRUCT)) - ? SUBST_TAINT_BOOLRET : 0)); + | (( (once && !(rpm->op_pmflags & PMf_NONDESTRUCT)) + || (PL_op->op_private & OPpTRUEBOOL)) ? SUBST_TAINT_BOOLRET : 0)); TAINT_NOT; } |