1c0f30
From c286e6d3aa2ecfc311027427c95607ceccb85fae Mon Sep 17 00:00:00 2001
1c0f30
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
1c0f30
Date: Tue, 27 Sep 2016 15:56:59 +0200
1c0f30
Subject: [PATCH 1/2] Deal with certain tiedscalars (e.g. created by
1c0f30
 Readonly::XS)
1c0f30
MIME-Version: 1.0
1c0f30
Content-Type: text/plain; charset=UTF-8
1c0f30
Content-Transfer-Encoding: 8bit
1c0f30
1c0f30
Upstream commit:
1c0f30
1c0f30
changeset:   480:efb44fbc6bd8
1c0f30
user:        John Peacock <john.peacock@havurah-software.org>
1c0f30
date:        Sat Feb 01 13:30:16 2014 -0500
1c0f30
summary:     Deal with certain tiedscalars (e.g. created by Readonly::XS).
1c0f30
1c0f30
ported from 0.9908 to 0.9907.
1c0f30
1c0f30
This is necessary to accept tainted input on perl older than 5.17.2.
1c0f30
1c0f30
Signed-off-by: Petr Písař <ppisar@redhat.com>
1c0f30
---
1c0f30
 vutil/vutil.c | 12 ++++++++++--
1c0f30
 1 file changed, 10 insertions(+), 2 deletions(-)
1c0f30
1c0f30
diff --git a/vutil/vutil.c b/vutil/vutil.c
1c0f30
index 7979c49..c5edb10 100644
1c0f30
--- a/vutil/vutil.c
1c0f30
+++ b/vutil/vutil.c
1c0f30
@@ -555,7 +555,11 @@ Perl_upg_version(pTHX_ SV *ver, bool qv)
1c0f30
 
1c0f30
     PERL_ARGS_ASSERT_UPG_VERSION;
1c0f30
 
1c0f30
-    if ( SvNOK(ver) && !( SvPOK(ver) && SvCUR(ver) == 3 ) )
1c0f30
+    if ( ( SvNOK(ver)
1c0f30
+#if PERL_VERSION_LT(5,17,2)
1c0f30
+       || (SvTYPE(ver) == SVt_PVMG && SvNOKp(ver))
1c0f30
+#endif
1c0f30
+       ) && !( SvPOK(ver) && SvCUR(ver) == 3 ) )
1c0f30
     {
1c0f30
 	STRLEN len;
1c0f30
 
1c0f30
@@ -602,7 +606,11 @@ Perl_upg_version(pTHX_ SV *ver, bool qv)
1c0f30
 	version = savesvpv(ver);
1c0f30
 	SAVEFREEPV(version);
1c0f30
     }
1c0f30
-    else if ( SvPOK(ver) )/* must be a string or something like a string */
1c0f30
+    else if ( SvPOK(ver)
1c0f30
+#if PERL_VERSION_LT(5,17,2)
1c0f30
+             || (SvTYPE(ver) == SVt_PVMG && SvPOKp(ver))
1c0f30
+#endif
1c0f30
+           )/* must be a string or something like a string */
1c0f30
     {
1c0f30
 	STRLEN len;
1c0f30
 	version = savepvn(SvPV(ver,len), SvCUR(ver));
1c0f30
-- 
1c0f30
2.7.4
1c0f30