diff -Nru apt-0.8.16~exp12ubuntu10.24/apt-pkg/deb/debindexfile.cc apt-0.8.16~exp12ubuntu10.25/apt-pkg/deb/debindexfile.cc --- apt-0.8.16~exp12ubuntu10.24/apt-pkg/deb/debindexfile.cc 2013-04-10 20:31:54.000000000 +0000 +++ apt-0.8.16~exp12ubuntu10.25/apt-pkg/deb/debindexfile.cc 2015-07-22 11:40:00.000000000 +0000 @@ -602,7 +602,8 @@ pkgCache::PkgFileIterator CFile = Gen.GetCurFile(); CFile->Size = Pkg.FileSize(); CFile->mtime = Pkg.ModificationTime(); - CFile->Archive = Gen.WriteUniqString("now"); + map_ptrloc const storage = Gen.WriteUniqString("now"); + CFile->Archive = storage; if (Gen.MergeList(Parser) == false) return _error->Error("Problem with MergeList %s",File.c_str()); diff -Nru apt-0.8.16~exp12ubuntu10.24/apt-pkg/deb/deblistparser.cc apt-0.8.16~exp12ubuntu10.25/apt-pkg/deb/deblistparser.cc --- apt-0.8.16~exp12ubuntu10.24/apt-pkg/deb/deblistparser.cc 2013-04-10 20:31:54.000000000 +0000 +++ apt-0.8.16~exp12ubuntu10.25/apt-pkg/deb/deblistparser.cc 2015-07-22 11:40:37.000000000 +0000 @@ -100,7 +100,8 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver) { // Parse the section - Ver->Section = UniqFindTagWrite("Section"); + unsigned long const idxSection = UniqFindTagWrite("Section"); + Ver->Section = idxSection; // Parse multi-arch string const MultiArch = Section.FindS("Multi-Arch"); @@ -234,7 +235,10 @@ pkgCache::VerIterator &Ver) { if (Pkg->Section == 0) - Pkg->Section = UniqFindTagWrite("Section"); + { + unsigned long const idxSection = UniqFindTagWrite("Section"); + Pkg->Section = idxSection; + } // Packages which are not from the "native" arch doesn't get the essential flag // in the default "native" mode - it is also possible to mark "all" or "none". @@ -771,7 +775,8 @@ { // apt-secure does no longer download individual (per-section) Release // file. to provide Component pinning we use the section name now - FileI->Component = WriteUniqString(component); + map_ptrloc const storage = WriteUniqString(component); + FileI->Component = storage; // FIXME: Code depends on the fact that Release files aren't compressed FILE* release = fdopen(dup(File.Fd()), "r"); @@ -858,13 +863,14 @@ break; *s = '\0'; } + map_ptrloc const storage = WriteUniqString(data); switch (writeTo) { - case Suite: FileI->Archive = WriteUniqString(data); break; - case Component: FileI->Component = WriteUniqString(data); break; - case Version: FileI->Version = WriteUniqString(data); break; - case Origin: FileI->Origin = WriteUniqString(data); break; - case Codename: FileI->Codename = WriteUniqString(data); break; - case Label: FileI->Label = WriteUniqString(data); break; + case Suite: FileI->Archive = storage; break; + case Component: FileI->Component = storage; break; + case Version: FileI->Version = storage; break; + case Origin: FileI->Origin = storage; break; + case Codename: FileI->Codename = storage; break; + case Label: FileI->Label = storage; break; case None: break; } } diff -Nru apt-0.8.16~exp12ubuntu10.24/apt-pkg/edsp/edspindexfile.cc apt-0.8.16~exp12ubuntu10.25/apt-pkg/edsp/edspindexfile.cc --- apt-0.8.16~exp12ubuntu10.24/apt-pkg/edsp/edspindexfile.cc 2013-04-10 20:31:54.000000000 +0000 +++ apt-0.8.16~exp12ubuntu10.25/apt-pkg/edsp/edspindexfile.cc 2015-07-22 11:41:00.000000000 +0000 @@ -51,7 +51,8 @@ pkgCache::PkgFileIterator CFile = Gen.GetCurFile(); CFile->Size = Pkg.FileSize(); CFile->mtime = Pkg.ModificationTime(); - CFile->Archive = Gen.WriteUniqString("edsp::scenario"); + map_ptrloc const storage = Gen.WriteUniqString("edsp::scenario"); + CFile->Archive = storage; if (Gen.MergeList(Parser) == false) return _error->Error("Problem with MergeList %s",File.c_str()); diff -Nru apt-0.8.16~exp12ubuntu10.24/debian/changelog apt-0.8.16~exp12ubuntu10.25/debian/changelog --- apt-0.8.16~exp12ubuntu10.24/debian/changelog 2015-05-20 14:30:42.000000000 +0000 +++ apt-0.8.16~exp12ubuntu10.25/debian/changelog 2015-07-22 12:16:39.000000000 +0000 @@ -1,3 +1,15 @@ +apt (0.8.16~exp12ubuntu10.25) precise; urgency=medium + + * Backport patches from David Kalnischkies to fix crashes with dynamic + cache remapping (LP: #957231): + - Do not dereference the storage for the unique strings as the pointer + can change at the time of writing the strings, so first store it + temporary and then save the index in the (possibly new) pointer + location + - Handle moved mmap after UniqFindTagWrite call (Closes: #753941) + + -- Colin Watson Wed, 22 Jul 2015 13:16:37 +0100 + apt (0.8.16~exp12ubuntu10.24) precise-proposed; urgency=low * fix crash for packages that have no section in their instVersion