[Reproducible-commits] [dpkg] 12/17: dpkg: Fix physical file offset comparison

Holger Levsen holger at layer-acht.org
Tue May 3 08:44:27 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to annotated tag 1.17.27
in repository dpkg.

commit adbdfb0dd9cec401609fd3eef232b7ff2153db7f
Author: Yuri Gribov <tetra2005 at gmail.com>
Date:   Thu Dec 24 12:22:26 2015 +0100

    dpkg: Fix physical file offset comparison
    
    The comparison function pkg_sorter_by_listfile_phys_offs passed to qsort
    does not satisfy qsort symmetry requirements, for some inputs
    
      pkg_sorter_by_listfile_phys_offs(a, b) != -
      pkg_sorter_by_listfile_phys_offs(b, a)
    
    This may cause various qsort misbehaviors e.g. failing to properly sort
    the input array (on some platforms qsort could even abort although that
    seems to not be the case for glibc-based systems).
    
    Closes: #808912
    Signed-off-by: Guillem Jover <guillem at debian.org>
---
 debian/changelog | 2 ++
 src/filesdb.c    | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index f2c9203..005ac91 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,6 +19,8 @@ dpkg (1.17.27) UNRELEASED; urgency=medium
     to «postinst configure», which might consider this a first install instead
     of an upgrade. Closes: #801156
   * Fix memory leak in dpkg infodb format upgrade logic.
+  * Fix physical file offset comparison in dpkg. Closes: #808912
+    Thanks to Yuri Gribov <tetra2005 at gmail.com>.
   * Build system:
     - Set PERL5LIB globally for the test suite to the local modules directory,
       to avoid using the system modules. Regression introduced in dpkg 1.17.8.
diff --git a/src/filesdb.c b/src/filesdb.c
index 759fe9a..47d77a4 100644
--- a/src/filesdb.c
+++ b/src/filesdb.c
@@ -312,8 +312,10 @@ pkg_sorter_by_listfile_phys_offs(const void *a, const void *b)
    * INT_MAX. */
   if (pa->clientdata->listfile_phys_offs < pb->clientdata->listfile_phys_offs)
     return -1;
-  else
+  else if (pa->clientdata->listfile_phys_offs > pb->clientdata->listfile_phys_offs)
     return 1;
+  else
+    return 0;
 }
 
 static void

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list