diff options
author | Julian Andres Klode <jak@debian.org> | 2016-01-11 17:36:58 +0100 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2016-01-11 17:41:16 +0100 |
commit | ace5a062fc5390e636b09c5684bfbeae755cf437 (patch) | |
tree | a7c8296a8a823b45d621072ea1b9a900bdb9fea1 /apt-private | |
parent | 1dbd5b4609346e1f8b42bdd1385e361fa196621b (diff) |
search: Handle packages without description
If a package has no description, we would crash in search. While
this should not happen, there seem to be some weird cases where
it does.
A safer way might be to make the whole parser thing safe
against this, so pkgRecords::Lookup(Desc.FileList()) works
and returns a parser where all values are empty. This would
also fix all other instances of this bug, if there are any.
Closes: #810622
Diffstat (limited to 'apt-private')
-rw-r--r-- | apt-private/private-search.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/apt-private/private-search.cc b/apt-private/private-search.cc index 0728b26c8..4f2bc4913 100644 --- a/apt-private/private-search.cc +++ b/apt-private/private-search.cc @@ -91,8 +91,11 @@ static bool FullTextSearch(CommandLine &CmdL) /*{{{*/ char const * const PkgName = P.Name(); pkgCache::DescIterator Desc = V.TranslatedDescription(); - pkgRecords::Parser &parser = records.Lookup(Desc.FileList()); - std::string const LongDesc = parser.LongDesc(); + std::string LongDesc = ""; + if (!Desc.end()) { + pkgRecords::Parser &parser = records.Lookup(Desc.FileList()); + LongDesc = parser.LongDesc(); + } bool all_found = true; for (std::vector<regex_t>::const_iterator pattern = Patterns.begin(); |