apt-pkg/pkgcachegen.cc: copy Arch to avoid segfault on cache remap
authorMichael Vogt <michael.vogt@ubuntu.com>
Mon, 1 Aug 2011 10:57:04 +0000 (12:57 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Mon, 1 Aug 2011 10:57:04 +0000 (12:57 +0200)
apt-pkg/pkgcachegen.cc

index efd764b..2bfb776 100644 (file)
@@ -636,7 +636,9 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress)
            Dynamic<pkgCache::VerIterator> DynV(V);
            for (; V.end() != true; V++)
            {
-              char const * const Arch = P.Arch();
+               // copy P.Arch() into a string here as a cache remap
+               // in NewDepends() later may alter the pointer location
+              string Arch = P.Arch() == NULL ? "" : P.Arch();
               map_ptrloc *OldDepLast = NULL;
               /* MultiArch handling introduces a lot of implicit Dependencies:
                - MultiArch: same → Co-Installable if they have the same version