diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2022-04-07 18:02:55 +0200 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2022-04-07 18:25:43 +0200 |
commit | 863421c52a0dd5bae66a882f470166d5bf8496dc (patch) | |
tree | 7762b72427a22372aeddbd1f43ff4563b68b7ad4 | |
parent | 1c62e01a94bd0b92a828c72002b973cb394d54cc (diff) |
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
-rw-r--r-- | apt-private/private-cacheset.cc | 3 |
1 files changed, 2 insertions, 1 deletions
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; |