cvs commit: src/lib/libstand bzipfs.c gzipfs.c
Maxim Sobolev
sobomax at FreeBSD.org
Mon Dec 17 17:50:50 PST 2007
sobomax 2007-12-18 01:50:50 UTC
FreeBSD src repository
Modified files:
lib/libstand bzipfs.c gzipfs.c
Log:
Fix logical bug in the bzip2 reading code, which results in bogus EIO
returned on a perfectly valid bzip2 stream whose decompressed size
is multiple of read-ahead buffer size. Reproduce the problem is easy:
create some power-of-two sized file (truncate -s 1m file will do),
bzip2 it and try to load it as md_image from loader. See how it fails.
The bug doesn't affect gzip code (which most of bzip2-reading code was
copied from) probably due to the fact that libgzip doesn't report
Z_STREAM_END with the last block, but requires extra call to inflate()
to retrieve it and has some extra data in the input stream at that time.
However, apply similar fix to gzipfs.c just in the case the API will
change in the future to do what bzip2 code does.
Add some ifdef'ed code to enable testing bzipfs.c from witin normal
FreeBSD environment as opposed to the restricted loader one, so that
one can use gdb and whatnot.
Sponsored by: Sippy Software, Inc., http://www.sippysoft.com/
MFC in: 7 days
Revision Changes Path
1.8 +45 -1 src/lib/libstand/bzipfs.c
1.14 +3 -1 src/lib/libstand/gzipfs.c
More information about the cvs-src
mailing list