summaryrefslogtreecommitdiff
path: root/apt-pkg/tagfile.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-12-29 16:04:42 +0100
committerMichael Vogt <mvo@debian.org>2013-12-29 16:04:42 +0100
commitf99a02461efe5183a00d5e73da197b85f93cf57a (patch)
tree1286d59d9700b4626111347bce45820a7cad6aba /apt-pkg/tagfile.cc
parenta127de147900050d3dbc3644ed468428749c46fd (diff)
parent23bd09778261c945b460b46d855b1a6ef998cfd8 (diff)
Merge remote-tracking branch 'mvo/debian/sid' into debian/sid
Diffstat (limited to 'apt-pkg/tagfile.cc')
-rw-r--r--apt-pkg/tagfile.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc
index e0802e3d5..bef3c76ba 100644
--- a/apt-pkg/tagfile.cc
+++ b/apt-pkg/tagfile.cc
@@ -259,7 +259,12 @@ bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength)
TagCount = 0;
while (TagCount+1 < sizeof(Indexes)/sizeof(Indexes[0]) && Stop < End)
{
- TrimRecord(true,End);
+ TrimRecord(true,End);
+
+ // this can happen when TrimRecord trims away the entire Record
+ // (e.g. because it just contains comments)
+ if(Stop == End)
+ return true;
// Start a new index and add it to the hash
if (isspace(Stop[0]) == 0)
@@ -273,7 +278,9 @@ bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength)
if (Stop == 0)
return false;
- for (; Stop+1 < End && Stop[1] == '\r'; Stop++);
+ for (; Stop+1 < End && Stop[1] == '\r'; Stop++)
+ /* nothing */
+ ;
// Double newline marks the end of the record
if (Stop+1 < End && Stop[1] == '\n')