]> git.saurik.com Git - apt.git/commitdiff
merged from david
authorMichael Vogt <egon@debian-devbox>
Fri, 11 May 2012 14:21:05 +0000 (16:21 +0200)
committerMichael Vogt <egon@debian-devbox>
Fri, 11 May 2012 14:21:05 +0000 (16:21 +0200)
13 files changed:
apt-pkg/cachefilter.cc
apt-pkg/deb/deblistparser.cc
apt-pkg/packagemanager.cc
apt-pkg/pkgcachegen.cc
cmdline/apt-extracttemplates.cc
cmdline/apt-internal-solver.cc
debian/changelog
debian/libapt-inst1.5.symbols
ftparchive/cachedb.cc
ftparchive/contents.cc
ftparchive/override.cc
prepare-release
test/libapt/hashsums_test.cc

index 9ec3fa699ba34d9e45a645dab5bb3b88823724a6..fb444208c21b6f1cebd2d9ae2fbd6cbbcbe381e6 100644 (file)
 #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 {
index 00e2bd900db73644c91ac76bcdc3612496ab9151..7bef6772c451e1dc03055e83314db2cb45752838 100644 (file)
@@ -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                 /*{{{*/
index b56619ef53c33abd2107c8c9bb311050851d610b..06151a165ddb60c2042c84d7527150a55b4b86c8 100644 (file)
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/sptr.h>
 
-#include <apti18n.h>
 #include <iostream>
 #include <fcntl.h>
+
+#include <apti18n.h>
                                                                        /*}}}*/
 using namespace std;
 
index ec072fddd76ac5bd9757673c4c76c0ce36e8c20d..d455e407075680a1b45a025fa40ef30e84cc17ac 100644 (file)
@@ -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)
index 60efafba544283d9b0ee0c569abfab0297bbe2f1..8fe15fdf928dc57be8323204aba42611dff856be 100644 (file)
 #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;
index 25ecb7af1d0773c13fb5bed21c4ef7367b192fb0..e7faf88a97a7b45c4dbbe19248cbe9d5eca2b2df 100644 (file)
@@ -7,6 +7,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/error.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/init.h>
 #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                                       /*{{{*/
index 34d6991b539d3275b15255391375040253440c9d..8eec902d0eaf0bf25987036c9e3a33c4ab1fd6ad 100644 (file)
@@ -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
 
index cade0990da049dcddd0e329b6f8caee0ecbc29fd..8fcd29a3e001a4fdaf106f2b6862e955696667aa 100644 (file)
@@ -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
index a8b637a80f377c760a5f6dccb83544be73177fec..c2318bf5301fee6b62a7245ded212568fc30796d 100644 (file)
 #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                                    /*{{{*/
index bbc5a1e2b95275cb4842d2cab023f6ff84641b6b..015c790e074a351440490262ace1a7d32751c80b 100644 (file)
 #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                   /*{{{*/
index d363fd0fe9830a5510ef8aea848f960b346020aa..760c201200c1d0d7a8d21380ad79983941927cfd 100644 (file)
 // 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                     /*{{{*/
index e02157b2461de6733295d6a6217922908098f51a..fd98c489fe17691f254aa604e9fa7887fe27e9a2 100755 (executable)
@@ -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
index 396e4cf6b36304e114731eb189a050f97df40138..e2d0aec5b0ae8a03d66d9e03180fb35679c0961a 100644 (file)
@@ -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");