summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <egon@debian-devbox>2012-05-11 16:21:05 +0200
committerMichael Vogt <egon@debian-devbox>2012-05-11 16:21:05 +0200
commit3f81d67e1b732c1fdc8c17990249eda0fc2e09d6 (patch)
tree038dbe61e80ac809de33bb8fc3c74e24f7fb8be6
parent99b4fefe0f303cf5ae5e8b9116404fc0fcc96e47 (diff)
parenta00a9b44a1e0abf944d88c36ceaac8afdd207dcb (diff)
merged from david
-rw-r--r--apt-pkg/cachefilter.cc4
-rw-r--r--apt-pkg/deb/deblistparser.cc17
-rw-r--r--apt-pkg/packagemanager.cc3
-rw-r--r--apt-pkg/pkgcachegen.cc10
-rw-r--r--cmdline/apt-extracttemplates.cc6
-rw-r--r--cmdline/apt-internal-solver.cc7
-rw-r--r--debian/changelog12
-rw-r--r--debian/libapt-inst1.5.symbols2
-rw-r--r--ftparchive/cachedb.cc5
-rw-r--r--ftparchive/contents.cc4
-rw-r--r--ftparchive/override.cc3
-rwxr-xr-xprepare-release17
-rw-r--r--test/libapt/hashsums_test.cc22
13 files changed, 91 insertions, 21 deletions
diff --git a/apt-pkg/cachefilter.cc b/apt-pkg/cachefilter.cc
index 9ec3fa699..fb444208c 100644
--- a/apt-pkg/cachefilter.cc
+++ b/apt-pkg/cachefilter.cc
@@ -10,11 +10,11 @@
#include <apt-pkg/error.h>
#include <apt-pkg/pkgcache.h>
-#include <apti18n.h>
-
#include <string>
#include <regex.h>
+
+#include <apti18n.h>
/*}}}*/
namespace APT {
namespace CacheFilter {
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 00e2bd900..7bef6772c 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -215,15 +215,22 @@ string debListParser::DescriptionLanguage()
*/
MD5SumValue debListParser::Description_md5()
{
- string value = Section.FindS("Description-md5");
-
- if (value.empty())
+ string const value = Section.FindS("Description-md5");
+ if (value.empty() == true)
{
MD5Summation md5;
md5.Add((Description() + "\n").c_str());
return md5.Result();
- } else
- return MD5SumValue(value);
+ }
+ else if (likely(value.size() == 32))
+ {
+ if (likely(value.find_first_not_of("0123456789abcdefABCDEF") == string::npos))
+ return MD5SumValue(value);
+ _error->Error("Malformed Description-md5 line; includes invalid character '%s'", value.c_str());
+ return MD5SumValue();
+ }
+ _error->Error("Malformed Description-md5 line; doesn't have the required length (32 != %d) '%s'", (int)value.size(), value.c_str());
+ return MD5SumValue();
}
/*}}}*/
// ListParser::UsePackage - Update a package structure /*{{{*/
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index b56619ef5..06151a165 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -25,9 +25,10 @@
#include <apt-pkg/configuration.h>
#include <apt-pkg/sptr.h>
-#include <apti18n.h>
#include <iostream>
#include <fcntl.h>
+
+#include <apti18n.h>
/*}}}*/
using namespace std;
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index ec072fddd..d455e4070 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -286,7 +286,7 @@ bool pkgCacheGenerator::MergeListPackage(ListParser &List, pkgCache::PkgIterator
pkgCache::DescIterator Desc = Ver.DescriptionList();
// a version can only have one md5 describing it
- if (MD5SumValue(Desc.md5()) != CurMd5)
+ if (Desc.end() == true || MD5SumValue(Desc.md5()) != CurMd5)
continue;
// don't add a new description if we have one for the given
@@ -304,6 +304,9 @@ bool pkgCacheGenerator::MergeListPackage(ListParser &List, pkgCache::PkgIterator
void const * const oldMap = Map.Data();
map_ptrloc const descindex = NewDescription(Desc, CurLang, CurMd5, *LastDesc);
+ if (unlikely(descindex == 0 && _error->PendingError()))
+ return _error->Error(_("Error occurred while processing %s (%s%d)"),
+ Pkg.Name(), "NewDescription", 1);
if (oldMap != Map.Data())
LastDesc += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
*LastDesc = descindex;
@@ -456,6 +459,9 @@ bool pkgCacheGenerator::MergeListVersion(ListParser &List, pkgCache::PkgIterator
oldMap = Map.Data();
map_ptrloc const descindex = NewDescription(Desc, CurLang, CurMd5, *LastDesc);
+ if (unlikely(descindex == 0 && _error->PendingError()))
+ return _error->Error(_("Error occurred while processing %s (%s%d)"),
+ Pkg.Name(), "NewDescription", 2);
if (oldMap != Map.Data())
LastDesc += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
*LastDesc = descindex;
@@ -1453,7 +1459,7 @@ bool IsDuplicateDescription(pkgCache::DescIterator Desc,
MD5SumValue const &CurMd5, std::string const &CurLang)
{
// Descriptions in the same link-list have all the same md5
- if (MD5SumValue(Desc.md5()) != CurMd5)
+ if (Desc.end() == true || MD5SumValue(Desc.md5()) != CurMd5)
return false;
for (; Desc.end() == false; ++Desc)
if (Desc.LanguageCode() == CurLang)
diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc
index 60efafba5..8fe15fdf9 100644
--- a/cmdline/apt-extracttemplates.cc
+++ b/cmdline/apt-extracttemplates.cc
@@ -36,11 +36,13 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
+#include <locale.h>
+
#include <fstream>
-#include <locale.h>
-#include <apti18n.h>
#include "apt-extracttemplates.h"
+
+#include <apti18n.h>
/*}}}*/
using namespace std;
diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc
index 25ecb7af1..e7faf88a9 100644
--- a/cmdline/apt-internal-solver.cc
+++ b/cmdline/apt-internal-solver.cc
@@ -7,6 +7,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/error.h>
#include <apt-pkg/cmndline.h>
#include <apt-pkg/init.h>
@@ -18,11 +20,10 @@
#include <apt-pkg/fileutl.h>
#include <apt-pkg/pkgsystem.h>
-#include <config.h>
-#include <apti18n.h>
-
#include <unistd.h>
#include <cstdio>
+
+#include <apti18n.h>
/*}}}*/
// ShowHelp - Show a help screen /*{{{*/
diff --git a/debian/changelog b/debian/changelog
index 34d6991b5..8eec902d0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -24,8 +24,18 @@ apt (0.9.3) unstable; urgency=low
* edsp/edspsystem.cc:
- check with RealFileExists for scenario file as otherwise a directory
like one provided with RootDir triggers the usage of EDSP
+ * debian/libapt-inst1.5.symbols:
+ - use the correct library name the symbols header
+ * apt-pkg/pkgcachegen.cc:
+ - check if NewDescription allocation has failed and error out accordingly
+ - check if we work on a valid description in IsDuplicateDescription as
+ we end up working on dangling pointers otherwise which segfaults on
+ s390x and ppc64 (Closes: #669427)
+ * apt-pkg/deb/deblistparser.cc:
+ - check length and containing chars for a given description md5sum
+ * ensure that apti18n.h is included last as advertised (Closes: #671623)
- -- David Kalnischkies <kalnischkies@gmail.com> Mon, 23 Apr 2012 22:02:58 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com> Sat, 05 May 2012 15:35:16 +0200
apt (0.9.2) unstable; urgency=low
diff --git a/debian/libapt-inst1.5.symbols b/debian/libapt-inst1.5.symbols
index cade0990d..8fcd29a3e 100644
--- a/debian/libapt-inst1.5.symbols
+++ b/debian/libapt-inst1.5.symbols
@@ -1,4 +1,4 @@
-libapt-inst.so.1.4 libapt-inst1.4 #MINVER#
+libapt-inst.so.1.5 libapt-inst1.5 #MINVER#
* Build-Depends-Package: libapt-pkg-dev
(c++)"ExtractTar::Done(bool)@Base" 0.8.0
(c++)"ExtractTar::Go(pkgDirStream&)@Base" 0.8.0
diff --git a/ftparchive/cachedb.cc b/ftparchive/cachedb.cc
index a8b637a80..c2318bf53 100644
--- a/ftparchive/cachedb.cc
+++ b/ftparchive/cachedb.cc
@@ -19,11 +19,12 @@
#include <apt-pkg/strutl.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/fileutl.h>
-
+
#include <netinet/in.h> // htonl, etc
-#include <apti18n.h>
#include "cachedb.h"
+
+#include <apti18n.h>
/*}}}*/
// CacheDB::ReadyDB - Ready the DB2 /*{{{*/
diff --git a/ftparchive/contents.cc b/ftparchive/contents.cc
index bbc5a1e2b..015c790e0 100644
--- a/ftparchive/contents.cc
+++ b/ftparchive/contents.cc
@@ -38,13 +38,15 @@
#include <apt-pkg/debfile.h>
#include <apt-pkg/extracttar.h>
#include <apt-pkg/error.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
-#include <apti18n.h>
#include "contents.h"
+
+#include <apti18n.h>
/*}}}*/
// GenContents::~GenContents - Free allocated memory /*{{{*/
diff --git a/ftparchive/override.cc b/ftparchive/override.cc
index d363fd0fe..760c20120 100644
--- a/ftparchive/override.cc
+++ b/ftparchive/override.cc
@@ -12,13 +12,14 @@
// Include Files /*{{{*/
#include <config.h>
-#include <apti18n.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/error.h>
#include <stdio.h>
#include "override.h"
+
+#include <apti18n.h>
/*}}}*/
// Override::ReadOverride - Read the override file /*{{{*/
diff --git a/prepare-release b/prepare-release
index e02157b24..fd98c489f 100755
--- a/prepare-release
+++ b/prepare-release
@@ -4,6 +4,23 @@ VERSION=$(dpkg-parsechangelog | sed -n -e '/^Version:/s/^Version: //p')
DISTRIBUTION=$(dpkg-parsechangelog | sed -n -e '/^Distribution:/s/^Distribution: //p')
if [ "$1" = 'pre-export' ]; then
+ libraryversioncheck() {
+ LIBRARY="$1"
+ VERSION="$2"
+ if [ ! -e "debian/${LIBRARY}${VERSION}.symbols" ]; then
+ echo >&2 "Library ${LIBRARY} in version ${VERSION} has no symbols file! (maybe forgot to rename?)"
+ exit 1
+ fi
+ if [ "$(head -n1 "debian/${LIBRARY}${VERSION}.symbols")" != "${LIBRARY}.so.${VERSION} ${LIBRARY}${VERSION} #MINVER#" ]; then
+ echo >&2 "Library ${LIBRARY}${VERSION} has incorrect version in symbol header! (»$(head -n1 "debian/${LIBRARY}${VERSION}.symbols")«)"
+ exit 2
+ fi
+ }
+
+ libraryversioncheck 'libapt-pkg' "$(awk -v ORS='.' '/^\#define APT_PKG_M/ {print $3}' apt-pkg/init.h | sed 's/\.$//')"
+ libraryversioncheck 'libapt-inst' "$(egrep '^MAJOR=' apt-inst/makefile |cut -d '=' -f 2)"
+
+
if [ "$DISTRIBUTION" = 'sid' ]; then
echo >&2 '»sid« is not a valid distribution. Replace it with »unstable« for you'
sed -i -e 's/) sid; urgency=/) unstable; urgency=/' debian/changelog
diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc
index 396e4cf6b..e2d0aec5b 100644
--- a/test/libapt/hashsums_test.cc
+++ b/test/libapt/hashsums_test.cc
@@ -42,6 +42,28 @@ template <class T> void TestMill(const char *Out)
int main(int argc, char** argv)
{
+ // test HashSumValue which doesn't calculate but just stores sums
+ {
+ string md5sum = argv[2];
+ MD5SumValue md5(md5sum);
+ equals(md5.Value(), md5sum);
+ }
+ {
+ string sha1sum = argv[3];
+ SHA1SumValue sha1(sha1sum);
+ equals(sha1.Value(), sha1sum);
+ }
+ {
+ string sha2sum = argv[4];
+ SHA256SumValue sha2(sha2sum);
+ equals(sha2.Value(), sha2sum);
+ }
+ {
+ string sha2sum = argv[5];
+ SHA512SumValue sha2(sha2sum);
+ equals(sha2.Value(), sha2sum);
+ }
+
// From FIPS PUB 180-1
Test<SHA1Summation>("","da39a3ee5e6b4b0d3255bfef95601890afd80709");
Test<SHA1Summation>("abc","a9993e364706816aba3e25717850c26c9cd0d89d");