From 863421c52a0dd5bae66a882f470166d5bf8496dc Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 7 Apr 2022 18:02:55 +0200 Subject: Fix segfault in CacheSetHelperAPTGet::tryVirtualPackage() We forgot to check whether Archive() and Codename() exist in the first place, sigh. Maybe we should return empty strings instead of nullptr. Reported-By: Johannes 'josch' Schauer Marin Rodrigues on IRC --- apt-private/private-cacheset.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apt-private/private-cacheset.cc b/apt-private/private-cacheset.cc index 2d85aaf4f..1b2834ea1 100644 --- a/apt-private/private-cacheset.cc +++ b/apt-private/private-cacheset.cc @@ -436,7 +436,8 @@ APT::VersionSet CacheSetHelperAPTGet::tryVirtualPackage(pkgCacheFile &Cache, pkg { case RELEASE: for (auto File = V.FileList(); not File.end(); ++File) - if (lastmatcher == File.File().Archive() || lastmatcher == File.File().Codename()) + if ((File.File().Archive() != nullptr && lastmatcher == File.File().Archive()) || + (File.File().Codename() != nullptr && lastmatcher == File.File().Codename())) { verset.push_back(V); break; -- cgit v1.2.3-70-g09d2