do not trust FileFd::Eof() in pkgTagFile::Fill()
authorDavid Kalnischkies <kalnischkies@gmail.com>
Fri, 20 Sep 2013 11:34:22 +0000 (13:34 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Fri, 20 Sep 2013 11:34:22 +0000 (13:34 +0200)
commit5985c230c8ac85fe2b2eb504b798377843bdc7cd
tree7e1d413b2d7da055b22aa75391c7bc11b01cb874
parent3e2d892340d42053d388bda3d50dfbee99299082
do not trust FileFd::Eof() in pkgTagFile::Fill()

The Eof check was added (by me of course) in
0aae6d14390193e25ab6d0fd49295bd7b131954f
as part of a fix up ~a month ago (at DebConf).

The idea was not that bad, but doesn't make that much sense either
as this bit is set by the FileFd based on Actual as well, so this is
basically doing the same check again – with the difference that the
HitEof bit can still linger from a previous Read we did at the end of
the file, but have seek'd away from it now.

Combined with the length of entries, entry order and other not that
easily controllable conditions you can be 'lucky' enough to hit this
problem in a way which even visible (truncating of other fields might
 not be visible easily, like 'Tags' and others).

Closes: 723705
Thanks: Cyril Brulebois
apt-pkg/tagfile.cc
test/integration/Packages-bug-723705-tagfile-truncates-fields [new file with mode: 0644]
test/integration/status-bug-723705-tagfile-truncates-fields [new file with mode: 0644]
test/integration/test-bug-723705-tagfile-truncates-fields [new file with mode: 0755]