From 7ca70a9af1bc6af753ee3012d1840d5ddfafe37c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 2 May 2011 10:41:38 +0200 Subject: merge single-arch :arch fix from my sid branch --- apt-pkg/pkgcache.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'apt-pkg/pkgcache.cc') diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index c6326abf1..93d09a18e 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -211,11 +211,14 @@ pkgCache::PkgIterator pkgCache::SingleArchFindPkg(const string &Name) // --------------------------------------------------------------------- /* Returns 0 on error, pointer to the package otherwise */ pkgCache::PkgIterator pkgCache::FindPkg(const string &Name) { - if (MultiArchCache() == false) - return SingleArchFindPkg(Name); size_t const found = Name.find(':'); if (found == string::npos) - return FindPkg(Name, "native"); + { + if (MultiArchCache() == false) + return SingleArchFindPkg(Name); + else + return FindPkg(Name, "native"); + } string const Arch = Name.substr(found+1); if (Arch == "any") return FindPkg(Name, "any"); -- cgit v1.2.3 From 27e8981a61bb9881154e727deb3d4adf75ad4d0a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 17 May 2011 18:19:24 +0200 Subject: remove deprecated methods which nobody should have used anyway like pseudo-package related and/or private --- apt-pkg/pkgcache.cc | 3 --- 1 file changed, 3 deletions(-) (limited to 'apt-pkg/pkgcache.cc') diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 38e4e904e..951caeb78 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -749,9 +749,6 @@ bool pkgCache::VerIterator::Automatic() const return false; } /*}}}*/ -// VerIterator::Pseudo - deprecated no-op method /*{{{*/ -bool pkgCache::VerIterator::Pseudo() const { return false; } - /*}}}*/ // VerIterator::NewestFile - Return the newest file version relation /*{{{*/ // --------------------------------------------------------------------- /* This looks at the version numbers associated with all of the sources -- cgit v1.2.3 From 0688ccd8d9ae40741f1a2ef0de25a59e2203fc5e Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 20 Jul 2011 16:37:56 +0200 Subject: apt-pkg/pkgcache.h: Add pkgCache::Header::CacheFileSize, storing the cache size --- apt-pkg/pkgcache.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'apt-pkg/pkgcache.cc') diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 951caeb78..1fd21a0ad 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -84,6 +84,8 @@ pkgCache::Header::Header() memset(PkgHashTable,0,sizeof(PkgHashTable)); memset(GrpHashTable,0,sizeof(GrpHashTable)); memset(Pools,0,sizeof(Pools)); + + CacheFileSize = 0; } /*}}}*/ // Cache::Header::CheckSizes - Check if the two headers have same *sz /*{{{*/ -- cgit v1.2.3 From 7d79339f811aeebacb3f841bac6075fdfbadd03f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 20 Jul 2011 16:38:40 +0200 Subject: * apt-pkg/pkgcache.cc: - Check that cache is at least CacheFileSize bytes large (LP: #16467) --- apt-pkg/pkgcache.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'apt-pkg/pkgcache.cc') diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 1fd21a0ad..2b8cb6b86 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -157,6 +157,9 @@ bool pkgCache::ReMap(bool const &Errorchecks) HeaderP->CheckSizes(DefHeader) == false) return _error->Error(_("The package cache file is an incompatible version")); + if (Map.Size() < HeaderP->CacheFileSize) + return _error->Error(_("The package cache file is corrupted, it is too small")); + // Locate our VS.. if (HeaderP->VerSysName == 0 || (VS = pkgVersioningSystem::GetVS(StrP + HeaderP->VerSysName)) == 0) -- cgit v1.2.3