]> git.saurik.com Git - apt.git/commitdiff
search: Handle packages without description
authorJulian Andres Klode <jak@debian.org>
Mon, 11 Jan 2016 16:36:58 +0000 (17:36 +0100)
committerJulian Andres Klode <jak@debian.org>
Mon, 11 Jan 2016 16:41:16 +0000 (17:41 +0100)
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
apt-private/private-search.cc

index 0728b26c8f5aa579321f7eca58828b37b7bcbd24..4f2bc491343b14ceb290912e3a31fbf9eaa28d4f 100644 (file)
@@ -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();