From 64dda04bd949ab73ca77732fcc5149cc7c2a5557 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 29 Jul 2011 13:37:33 +0200 Subject: * apt-pkg/pkgcachegen.{cc,h}: - use ref-to-ptr semantic in NewDepends() to ensure that the libapt does not segfault if the cache is remapped in between (LP: #812862) --- apt-pkg/pkgcachegen.cc | 5 ++++- apt-pkg/pkgcachegen.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index d0ea2e6e3..ebcbfdd25 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -105,6 +105,9 @@ void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newM if (oldMap == newMap) return; + if (_config->FindB("Debug::pkgCacheGen", false)) + std::clog << "Remaping from " << oldMap << " to " << newMap << std::endl; + Cache.ReMap(false); CurrentFile += (pkgCache::PackageFile*) newMap - (pkgCache::PackageFile*) oldMap; @@ -684,7 +687,7 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg, string const &Version, unsigned int const &Op, unsigned int const &Type, - map_ptrloc *OldDepLast) + map_ptrloc* &OldDepLast) { void const * const oldMap = Map.Data(); // Get a structure diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index ff198833a..c26051182 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -75,7 +75,7 @@ class pkgCacheGenerator /*{{{*/ bool NewFileDesc(pkgCache::DescIterator &Desc,ListParser &List); bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver, string const &Version, unsigned int const &Op, - unsigned int const &Type, map_ptrloc *OldDepLast); + unsigned int const &Type, map_ptrloc* &OldDepLast); unsigned long NewVersion(pkgCache::VerIterator &Ver,const string &VerStr,unsigned long Next); map_ptrloc NewDescription(pkgCache::DescIterator &Desc,const string &Lang,const MD5SumValue &md5sum,map_ptrloc Next); -- cgit v1.2.3