summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-05-25 13:46:52 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2024-06-13 14:32:32 +0200
commit5502c0bc5754499e82a1e03ca5a24779adb6f485 (patch)
tree4ba5fd868313139afc6de56a4c7cd86702e40a2a
parentbfb9f2124b8f9da48b53d279278de3f8f0a00b82 (diff)
solver3: Do not dump sizes that are clearly pointers
We use a union here, but we don't know if we last stored a pointer, so let's just reject clearly non-sizes. Generally this will work fine -- you will not have enough choices in a dependency that you can construct a valid pointer to a Version*, especially given that any Version * > sizeof(pkgCache::Header) already, given it is in the cache.
-rw-r--r--apt-pkg/solver3.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc
index 9831f7e14..f851a98b8 100644
--- a/apt-pkg/solver3.cc
+++ b/apt-pkg/solver3.cc
@@ -211,7 +211,7 @@ void APT::Solver::Work::Dump(pkgCache &cache)
std::cerr << "Dirty ";
if (optional)
std::cerr << "Optional ";
- std::cerr << "Item (" << size << "@" << depth << (upgrade ? "u" : "") << ") ";
+ std::cerr << "Item (" << ssize_t(size <= solutions.size() ? size : -1) << "@" << depth << (upgrade ? "u" : "") << ") ";
if (auto Pkg = reason.Pkg(); Pkg != 0)
std::cerr << pkgCache::PkgIterator(cache, cache.PkgP + Pkg).FullName();
if (auto Ver = reason.Ver(); Ver != 0)