浏览代码

pkgcachegen: Account for remapping when parsing depends from NewPackage

In both the Ver and Dep variables, we need to account for remapping,
as otherwise we would still reference the old bug.

Reproduction environment:

* An i386 system with amd64 foreign architecture
* A sources.list with
deb http://snapshot.debian.org/archive/debian/20150826T102846Z/ unstable main
deb http://snapshot.debian.org/archive/debian/20150826T102846Z/ experimental main

Thanks: Jakub Wilk for the bug report and the backtraces
Closes: #796999
Julian Andres Klode 11 年之前
父节点
当前提交
05c001c8db
共有 1 个文件被更改,包括 6 次插入 和 2 次删除
  1. 6 2
      apt-pkg/pkgcachegen.cc

+ 6 - 2
apt-pkg/pkgcachegen.cc

@@ -594,8 +594,10 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name
       // and negative dependencies, don't forget negative dependencies
       // and negative dependencies, don't forget negative dependencies
       {
       {
 	 pkgCache::PkgIterator const M = Grp.FindPreferredPkg(false);
 	 pkgCache::PkgIterator const M = Grp.FindPreferredPkg(false);
-	 if (M.end() == false)
-	    for (pkgCache::DepIterator Dep = M.RevDependsList(); Dep.end() == false; ++Dep)
+	 if (M.end() == false) {
+	    pkgCache::DepIterator Dep;
+	    Dynamic<pkgCache::DepIterator> DynDep(Dep);
+	    for (Dep = M.RevDependsList(); Dep.end() == false; ++Dep)
 	    {
 	    {
 	       if ((Dep->CompareOp & (pkgCache::Dep::ArchSpecific | pkgCache::Dep::MultiArchImplicit)) != 0)
 	       if ((Dep->CompareOp & (pkgCache::Dep::ArchSpecific | pkgCache::Dep::MultiArchImplicit)) != 0)
 		  continue;
 		  continue;
@@ -603,10 +605,12 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name
 		     Dep->Type != pkgCache::Dep::Replaces)
 		     Dep->Type != pkgCache::Dep::Replaces)
 		  continue;
 		  continue;
 	       pkgCache::VerIterator Ver = Dep.ParentVer();
 	       pkgCache::VerIterator Ver = Dep.ParentVer();
+	       Dynamic<pkgCache::VerIterator> DynVer(Ver);
 	       map_pointer_t * unused = NULL;
 	       map_pointer_t * unused = NULL;
 	       if (NewDepends(Pkg, Ver, Dep->Version, Dep->CompareOp, Dep->Type, unused) == false)
 	       if (NewDepends(Pkg, Ver, Dep->Version, Dep->CompareOp, Dep->Type, unused) == false)
 		  return false;
 		  return false;
 	    }
 	    }
+	 }
       }
       }
 
 
       // this package is the new last package
       // this package is the new last package