summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcachegen.h
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2025-02-24 13:18:08 +0100
committerJulian Andres Klode <jak@debian.org>2025-02-24 12:24:17 +0000
commit55d3bc60f933faf5f46e31c0522bed8320409dcf (patch)
tree798cb5b16edf07bd771f391c83e0dad8da2a044e /apt-pkg/pkgcachegen.h
parentfdcdce3bfecd8f7ea577bfa1d1dc7f04e9cf7d45 (diff)
Fix crash in VersionExtra using --with-source etc
VersionExtra holds, at runtime, the SHA256 of the packages being added to try to avoid deduplicating obviously different packages; the SHA256 itself is too large to store in the cache. When volatile sources are used, the VersionExtra array is not initialized, or rather it used to be initialized to 32*1024 zero elements as a performance optimization. This meant that specifying --with-source with a package that looks like a duplicate of a version with an ID >= 32*1024 triggered the assertion; so we could not reproduce it easily in the test suite. Remove the optimized initialization to make the behavior more uniform; and treat too large version IDs as having no SHA256. Closes: #1098702
Diffstat (limited to 'apt-pkg/pkgcachegen.h')
-rw-r--r--apt-pkg/pkgcachegen.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h
index 85c80035a..b67b37559 100644
--- a/apt-pkg/pkgcachegen.h
+++ b/apt-pkg/pkgcachegen.h
@@ -80,7 +80,7 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/
{
char SHA256[64];
};
- std::vector<VersionExtra> VersionExtra{32 * 1024};
+ std::vector<VersionExtra> VersionExtra;
friend class pkgCacheListParser;
typedef pkgCacheListParser ListParser;