From 06bba740f0085bcd6262cece62dcff266d8efe95 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:52:55 +0000 Subject: Fixed another parser glitch Author: jgg Date: 1999-02-22 03:30:06 GMT Fixed another parser glitch --- apt-pkg/deb/debrecords.cc | 5 +++-- apt-pkg/deb/debrecords.h | 4 ++-- apt-pkg/pkgrecords.cc | 4 ++-- apt-pkg/tagfile.cc | 14 +++++++++----- 4 files changed, 16 insertions(+), 11 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index e06533e19..b3f91a840 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: debrecords.cc,v 1.4 1999/01/27 02:48:53 jgg Exp $ +// $Id: debrecords.cc,v 1.5 1999/02/22 03:30:06 jgg Exp $ /* ###################################################################### Debian Package Records - Parser for debian package records @@ -18,7 +18,8 @@ // RecordParser::debRecordParser - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ -debRecordParser::debRecordParser(FileFd &File) : Tags(File,4*1024) +debRecordParser::debRecordParser(FileFd &File,pkgCache &Cache) : + Tags(File,Cache.Head().MaxVerFileSize + 20) { } /*}}}*/ diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index 68fe0f6a6..0c204492a 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: debrecords.h,v 1.3 1998/11/13 04:23:38 jgg Exp $ +// $Id: debrecords.h,v 1.4 1999/02/22 03:30:06 jgg Exp $ /* ###################################################################### Debian Package Records - Parser for debian package records @@ -44,7 +44,7 @@ class debRecordParser : public pkgRecords::Parser virtual string ShortDesc(); virtual string LongDesc(); - debRecordParser(FileFd &File); + debRecordParser(FileFd &File,pkgCache &Cache); }; diff --git a/apt-pkg/pkgrecords.cc b/apt-pkg/pkgrecords.cc index 5d982caf3..5d112a5c1 100644 --- a/apt-pkg/pkgrecords.cc +++ b/apt-pkg/pkgrecords.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: pkgrecords.cc,v 1.4 1998/11/13 04:23:34 jgg Exp $ +// $Id: pkgrecords.cc,v 1.5 1999/02/22 03:30:06 jgg Exp $ /* ###################################################################### Package Records - Allows access to complete package description records @@ -40,7 +40,7 @@ pkgRecords::pkgRecords(pkgCache &Cache) : Cache(Cache), Files(0) return; // Create the parser - Files[I->ID].Parse = new debRecordParser(*Files[I->ID].File); + Files[I->ID].Parse = new debRecordParser(*Files[I->ID].File,Cache); if (_error->PendingError() == true) return; } diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index 5d45b59bc..53e1e5e8b 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: tagfile.cc,v 1.23 1999/02/21 08:38:53 jgg Exp $ +// $Id: tagfile.cc,v 1.24 1999/02/22 03:30:06 jgg Exp $ /* ###################################################################### Fast scanner for RFC-822 type header information @@ -127,8 +127,11 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long Offset) return false; if (Tag.Scan(Start,End - Start) == false) + { + cout << string(Start,End) << endl; return _error->Error("Unable to parse package file %s (2)",Fd.Name().c_str()); - + } + return true; } /*}}}*/ @@ -212,9 +215,12 @@ bool pkgTagSection::Find(const char *Tag,const char *&Start, // Strip off the gunk from the start end Start = C; End = Section + Indexes[I+1]; + if (Start >= End) + return _error->Error("Internal parsing error"); + for (; (isspace(*Start) != 0 || *Start == ':') && Start < End; Start++); for (; isspace(End[-1]) != 0 && End > Start; End--); - + return true; } @@ -286,5 +292,3 @@ bool pkgTagSection::FindFlag(const char *Tag,unsigned long &Flags, return true; } /*}}}*/ - - -- cgit v1.2.3