[Reproducible-commits] [dpkg] 06/10: dpkg: Fix physical file offset comparison

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


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

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

commit 52d67f414d07f1f26812da15a9f563bb99a7dd7d
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 35496b7..15e35cc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,8 @@ dpkg (1.16.18) UNRELEASED; urgency=medium
     to «postinst configure», which might consider this a first install instead
     of an upgrade. Closes: #801156
   * Fix memory leaks in dpkg infodb format upgrade logic.
+  * Fix physical file offset comparison in dpkg. Closes: #808912
+    Thanks to Yuri Gribov <tetra2005 at gmail.com>.
 
  -- Guillem Jover <guillem at debian.org>  Sat, 19 Mar 2016 19:13:34 +0100
 
diff --git a/src/filesdb.c b/src/filesdb.c
index af34810..79677b9 100644
--- a/src/filesdb.c
+++ b/src/filesdb.c
@@ -343,8 +343,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