diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2019-02-06 15:01:22 +0100 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2019-02-08 13:01:21 +0100 |
commit | 5d07bad6105eb1b7c158c502fe89803e120be064 (patch) | |
tree | 4c92a9f4ed6461ba31b4d700c6a7295ff2450009 /apt-pkg | |
parent | 7b552715c93e1b4e113d5a5e85c31ed1db1eb43b (diff) |
Fix crashes in apt search, cache file
When BuildDepCaches() is called before BuildCaches() we end up
with dereferencing a null pointer cache in the depcache constructor.
Furthermore, in private-search, we check that Cache == NULL, but
only after constructing the policy and records, which does not
work reliably, because the records construction accesses the cache
as well.
LP: #1815187
Test-Case: ./build/bin/apt search -o RootDir=/dev/null foo
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/cachefile.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc index 0fd40106f..96bcdc097 100644 --- a/apt-pkg/cachefile.cc +++ b/apt-pkg/cachefile.cc @@ -140,6 +140,8 @@ bool pkgCacheFile::BuildPolicy(OpProgress * /*Progress*/) /* */ bool pkgCacheFile::BuildDepCache(OpProgress *Progress) { + if (BuildCaches(Progress, false) == false) + return false; if (DCache != NULL) return true; |