summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2021-01-13 16:43:04 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2021-01-13 16:43:04 +0100
commit34bf934a6275d4c8b21d2571a9d1597a9a4b9c15 (patch)
tree4661840a854870c170aecb103f9a3c86855cdc7f
parente9d659be2ac4772a19c10b6cea91687fe084876e (diff)
pkgcachegen: Avoid write to old cache for Version::Extra
Assigning the result of AllocateInMap directly to Ver->d caused Ver->d to be resolved first, and hence if Ver was remapped during the AllocateInMap, we were trying to assign to the old value. Closes: #980037
-rw-r--r--apt-pkg/pkgcachegen.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index bd81ca0f5..26cf7fc68 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -873,7 +873,8 @@ map_pointer<pkgCache::Version> pkgCacheGenerator::NewVersion(pkgCache::VerIterat
// Fill it in
Ver = pkgCache::VerIterator(Cache,Cache.VerP + Version);
- Ver->d = AllocateInMap<pkgCache::Version::Extra>();
+ auto d = AllocateInMap<pkgCache::Version::Extra>(); // sequence point so Ver can be moved if needed
+ Ver->d = d;
if (not Ver.PhasedUpdatePercentage(100))
abort();