diff options
author | Michael Vogt <egon@debian-devbox> | 2012-05-11 16:21:05 +0200 |
---|---|---|
committer | Michael Vogt <egon@debian-devbox> | 2012-05-11 16:21:05 +0200 |
commit | 3f81d67e1b732c1fdc8c17990249eda0fc2e09d6 (patch) | |
tree | 038dbe61e80ac809de33bb8fc3c74e24f7fb8be6 /apt-pkg | |
parent | 99b4fefe0f303cf5ae5e8b9116404fc0fcc96e47 (diff) | |
parent | a00a9b44a1e0abf944d88c36ceaac8afdd207dcb (diff) |
merged from david
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/cachefilter.cc | 4 | ||||
-rw-r--r-- | apt-pkg/deb/deblistparser.cc | 17 | ||||
-rw-r--r-- | apt-pkg/packagemanager.cc | 3 | ||||
-rw-r--r-- | apt-pkg/pkgcachegen.cc | 10 |
4 files changed, 24 insertions, 10 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) |