Date: Tue, 18 Dec 2007 01:50:50 +0000 (UTC) From: Maxim Sobolev <sobomax@FreeBSD.org> To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/lib/libstand bzipfs.c gzipfs.c Message-ID: <200712180150.lBI1ooK9097684@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712180150.lBI1ooK9097684>