summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mg.c2
-rw-r--r--t/op/taint.t10
2 files changed, 10 insertions, 2 deletions
diff --git a/mg.c b/mg.c
index e1fc578f8b..9dc0679f37 100644
--- a/mg.c
+++ b/mg.c
@@ -2237,7 +2237,7 @@ Perl_magic_gettaint(pTHX_ SV *sv, MAGIC *mg)
PERL_UNUSED_ARG(mg);
#endif
- TAINT_IF((PL_localizing != 1) && (mg->mg_len & 1));
+ TAINT_IF((PL_localizing != 1) && (mg->mg_len & 1) && IN_PERL_RUNTIME);
return 0;
}
diff --git a/t/op/taint.t b/t/op/taint.t
index 20449def8d..6ec66cec9e 100644
--- a/t/op/taint.t
+++ b/t/op/taint.t
@@ -16,7 +16,7 @@ BEGIN {
use strict;
use Config;
-plan tests => 800;
+plan tests => 801;
$| = 1;
@@ -2322,6 +2322,14 @@ $::x = "foo";
$_ = "$TAINT".reset "x";
is eval { eval $::x.1 }, 1, 'reset does not taint undef';
+# [perl #122669]
+is runperl(
+ switches => [ '-T' ],
+ prog => 'use constant K=>$^X; 0 if K; BEGIN{} use strict; print 122669, qq-\n-',
+ stderr => 1,
+ ), "122669\n",
+ 'tainted constant as logop condition should not prevent "use"';
+
# This may bomb out with the alarm signal so keep it last
SKIP: {
skip "No alarm()" unless $Config{d_alarm};