summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2017-12-19 14:52:49 +0000
committerDavid Mitchell <davem@iabyn.com>2017-12-19 15:15:02 +0000
commit5e501dc57f49d52e0f2a302181be287457c0b736 (patch)
tree456a97ff9eaf94ad1ed0f7aee374edb97399ce97 /pp_hot.c
parentc352ee5f96ca31651e1bac4e2f72702d961e700c (diff)
downloadperl-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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 958aa6e40e..bba90a8d9c 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -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;
}