[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#877937: marked as done (stretch-pu: package libdbd-firebird-perl/1.24-1)



Your message dated Sat, 09 Dec 2017 10:46:36 +0000
with message-id <1512816396.1994.30.camel@adam-barratt.org.uk>
and subject line Closing bugs for updates included in stretch point release
has caused the Debian Bug report #877937,
regarding stretch-pu: package libdbd-firebird-perl/1.24-1
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
877937: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=877937
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
Tags: stretch
User: release.debian.org@packages.debian.org
Usertags: pu

libdbd-firebird-perl before 1.25 suffers from a bug (#877720) leading to 
data corruption when fetching decimal(x,y) values between -1 and 0. The 
fetched data is positive, instead of negative.

(libdbd-firebird-perl is a driver for connecting DBI, the standard Perl 
database interface, to Firebird SQL server)

The fix is taken from the upstream commit (of which I am also the 
author).

Targeted patch and full source debdiff attached.


-- dam
b4fad5d264abafeb26e1333b74f6a5c2f75f4869 dbd_st_fetch: fix conversion of numerics between -1 and 0
diff --git a/dbdimp.c b/dbdimp.c
index 1c48d7c..ff7b510 100644
--- a/dbdimp.c
+++ b/dbdimp.c
@@ -1431,20 +1431,28 @@ AV *dbd_st_fetch(SV *sth, imp_sth_t *imp_sth)
 #endif
                     if (var->sqlscale == 0) {
                         snprintf(buf, sizeof(buf), "%"DBD_IB_INT64f, i);
+                        sv_setpvn(sv, buf, strlen(buf));
                     } else {
+                        bool sign = ( i < 0 );
                         ISC_INT64 divisor, remainder;
                         divisor   = scales[-var->sqlscale];
+                        if (sign) divisor = -divisor;
                         remainder = (i%divisor);
                         if (remainder < 0) remainder = -remainder;
 
-                        snprintf(buf, sizeof(buf),
+                        snprintf(buf+1, sizeof(buf)-1,
                                 "%"DBD_IB_INT64f".%0*"DBD_IB_INT64f,
                                 i/divisor, -var->sqlscale, remainder);
 			DBI_TRACE_imp_xxh(imp_sth, 3, (DBIc_LOGPIO(imp_sth), "-------------->SQLINT64=%"DBD_IB_INT64f".%0*"DBD_IB_INT64f,i/divisor, -var->sqlscale, remainder ));
 
+                        if (sign) {
+                            *buf = '-';
+                            sv_setpvn(sv, buf, strlen(buf));
+                        }
+                        else {
+                            sv_setpvn(sv, buf+1, strlen(buf+1));
+                        }
                     }
-
-                    sv_setpvn(sv, buf, strlen(buf));
                 }
                 break;
 #endif
diff -Nru libdbd-firebird-perl-1.24/debian/changelog libdbd-firebird-perl-1.24/debian/changelog
--- libdbd-firebird-perl-1.24/debian/changelog	2016-10-11 12:02:22.000000000 +0300
+++ libdbd-firebird-perl-1.24/debian/changelog	2017-10-07 18:45:00.000000000 +0300
@@ -1,3 +1,10 @@
+libdbd-firebird-perl (1.24-1+deb9u1) stretch; urgency=medium
+
+  * add upstream patch fixing fetching of decimal(x,y) values between -1 and 0
+    (Closes: #877720)
+
+ -- Damyan Ivanov <dmn@debian.org>  Sat, 07 Oct 2017 15:45:00 +0000
+
 libdbd-firebird-perl (1.24-1) unstable; urgency=medium
 
   * New upstream version 1.24
diff -Nru libdbd-firebird-perl-1.24/debian/patches/decimal-fetch-between-minus-one-and-zero.patch libdbd-firebird-perl-1.24/debian/patches/decimal-fetch-between-minus-one-and-zero.patch
--- libdbd-firebird-perl-1.24/debian/patches/decimal-fetch-between-minus-one-and-zero.patch	1970-01-01 02:00:00.000000000 +0200
+++ libdbd-firebird-perl-1.24/debian/patches/decimal-fetch-between-minus-one-and-zero.patch	2017-10-07 18:42:15.000000000 +0300
@@ -0,0 +1,37 @@
+b4fad5d264abafeb26e1333b74f6a5c2f75f4869 dbd_st_fetch: fix conversion of numerics between -1 and 0
+diff --git a/dbdimp.c b/dbdimp.c
+index 1c48d7c..ff7b510 100644
+--- a/dbdimp.c
++++ b/dbdimp.c
+@@ -1431,20 +1431,28 @@ AV *dbd_st_fetch(SV *sth, imp_sth_t *imp_sth)
+ #endif
+                     if (var->sqlscale == 0) {
+                         snprintf(buf, sizeof(buf), "%"DBD_IB_INT64f, i);
++                        sv_setpvn(sv, buf, strlen(buf));
+                     } else {
++                        bool sign = ( i < 0 );
+                         ISC_INT64 divisor, remainder;
+                         divisor   = scales[-var->sqlscale];
++                        if (sign) divisor = -divisor;
+                         remainder = (i%divisor);
+                         if (remainder < 0) remainder = -remainder;
+ 
+-                        snprintf(buf, sizeof(buf),
++                        snprintf(buf+1, sizeof(buf)-1,
+                                 "%"DBD_IB_INT64f".%0*"DBD_IB_INT64f,
+                                 i/divisor, -var->sqlscale, remainder);
+ 			DBI_TRACE_imp_xxh(imp_sth, 3, (DBIc_LOGPIO(imp_sth), "-------------->SQLINT64=%"DBD_IB_INT64f".%0*"DBD_IB_INT64f,i/divisor, -var->sqlscale, remainder ));
+ 
++                        if (sign) {
++                            *buf = '-';
++                            sv_setpvn(sv, buf, strlen(buf));
++                        }
++                        else {
++                            sv_setpvn(sv, buf+1, strlen(buf+1));
++                        }
+                     }
+-
+-                    sv_setpvn(sv, buf, strlen(buf));
+                 }
+                 break;
+ #endif
diff -Nru libdbd-firebird-perl-1.24/debian/patches/series libdbd-firebird-perl-1.24/debian/patches/series
--- libdbd-firebird-perl-1.24/debian/patches/series	1970-01-01 02:00:00.000000000 +0200
+++ libdbd-firebird-perl-1.24/debian/patches/series	2017-10-07 18:42:15.000000000 +0300
@@ -0,0 +1 @@
+decimal-fetch-between-minus-one-and-zero.patch

--- End Message ---
--- Begin Message ---
Version: 9.3

Hi,

Each of the updates referenced in these bugs was included in this
morning's stretch point release. Thanks!

Regards,

Adam

--- End Message ---

Reply to: