[libdbd-mysql-perl] 01/02: Add regression-fix-float_type_conversion.patch
gregor herrmann
gregoa at debian.org
Sat Feb 25 21:45:18 UTC 2017
This is an automated email from the git hooks/post-receive script.
gregoa pushed a commit to branch master
in repository libdbd-mysql-perl.
commit 01546f17b9774a5a42dc46ef072fb075fedca62f
Author: gregor herrmann <gregoa at debian.org>
Date: Sat Feb 25 22:25:25 2017 +0100
Add regression-fix-float_type_conversion.patch
to fix a regression in the conversion of floats which under some
circumstances simply returned 0.
Thanks: Brian May for the bug report, and Pali Rohár for backporting his fix to 4.041.
Closes: #856064
---
.../regression-fix-float_type_conversion.patch | 47 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 48 insertions(+)
diff --git a/debian/patches/regression-fix-float_type_conversion.patch b/debian/patches/regression-fix-float_type_conversion.patch
new file mode 100644
index 0000000..041ba0a
--- /dev/null
+++ b/debian/patches/regression-fix-float_type_conversion.patch
@@ -0,0 +1,47 @@
+From: Pali <pali at cpan.org>
+Date: Fri, 24 Feb 2017 19:51:36 +0100
+Subject: [PATCH] Fix type conversions
+
+Calling SvNV() for magical scalar is not enough for float type conversion.
+It caused problem for Amavis in tainted mode -- all float values were zero.
+On the other hand SvIV() and SvUV() seems to work fine. To be sure that
+correct value of float is in scalar use sv_setnv() with explicit NV float
+value. Similar code is changed also for integers IV/UV.
+
+This patch should fix reported Amavis bug:
+https://github.com/perl5-dbi/DBD-mysql/issues/78
+
+See also reported perl bug about SvNV():
+https://rt.perl.org/Public/Bug/Display.html?id=130801
+
+Bugs: https://github.com/perl5-dbi/DBD-mysql/issues/78
+Bugs-Debian: https://bugs.debian.org/856064
+
+--- a/dbdimp.c
++++ b/dbdimp.c
+@@ -4250,8 +4250,7 @@
+ switch (mysql_to_perl_type(fields[i].type)) {
+ case MYSQL_TYPE_DOUBLE:
+ /* Coerce to dobule and set scalar as NV */
+- (void) SvNV(sv);
+- SvNOK_only(sv);
++ sv_setnv(sv, SvNV(sv));
+ break;
+
+ case MYSQL_TYPE_LONG:
+@@ -4259,13 +4258,11 @@
+ /* Coerce to integer and set scalar as UV resp. IV */
+ if (fields[i].flags & UNSIGNED_FLAG)
+ {
+- (void) SvUV(sv);
+- SvIOK_only_UV(sv);
++ sv_setuv(sv, SvUV(sv));
+ }
+ else
+ {
+- (void) SvIV(sv);
+- SvIOK_only(sv);
++ sv_setiv(sv, SvIV(sv));
+ }
+ break;
+
diff --git a/debian/patches/series b/debian/patches/series
index 888c730..119fb57 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
test-user.patch
+regression-fix-float_type_conversion.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdbd-mysql-perl.git
More information about the Pkg-perl-cvs-commits
mailing list