From f330c0f347619f72766069acdc24616ec5fe7147 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 13 Feb 2011 13:06:03 +0100 Subject: [PATCH] =?utf8?q?*=20apt-pkg/contrib/fileutl.cc:=20=20=20-=20reor?= =?utf8?q?der=20the=20loaded=20filesize=20bytes=20for=20big=20endian=20(Cl?= =?utf8?q?oses:=20#612986)=20=20=20=20=20Thanks=20to=20J=C3=B6rg=20Sommer?= =?utf8?q?=20for=20the=20detailed=20analyse!?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- apt-pkg/contrib/fileutl.cc | 7 ++++++- debian/changelog | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 52f517ee0..6a621e2a9 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -962,9 +962,14 @@ unsigned long FileFd::Size() off_t orig_pos = lseek(iFd, 0, SEEK_CUR); if (lseek(iFd, -4, SEEK_END) < 0) return _error->Errno("lseek","Unable to seek to end of gzipped file"); + size = 0L; if (read(iFd, &size, 4) != 4) return _error->Errno("read","Unable to read original size of gzipped file"); - size &= 0xFFFFFFFF; + +#ifdef WORDS_BIGENDIAN + unsigned char const * const p = (unsigned char *) &size; + size = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]; +#endif if (lseek(iFd, orig_pos, SEEK_SET) < 0) return _error->Errno("lseek","Unable to seek in gzipped file"); diff --git a/debian/changelog b/debian/changelog index 86d31d856..5efc99233 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -apt (0.8.12) unstable; urgency=low +apt (0.8.11.2) unstable; urgency=low [ David Kalnischkies ] * cmdline/apt-get.cc: @@ -12,8 +12,11 @@ apt (0.8.12) unstable; urgency=low - update size of dynamic MMap as we write in from the outside * apt-pkg/contrib/mmap.cc: - do not try to free the mapping if its is unset + * apt-pkg/contrib/fileutl.cc: + - reorder the loaded filesize bytes for big endian (Closes: #612986) + Thanks to Jörg Sommer for the detailed analyse! - -- David Kalnischkies Sun, 13 Feb 2011 11:36:11 +0100 + -- David Kalnischkies Sun, 13 Feb 2011 12:15:59 +0100 apt (0.8.11.1) unstable; urgency=low -- 2.47.2