From owner-cvs-all@FreeBSD.ORG Tue Dec 18 01:50:50 2007 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AA1116A417; Tue, 18 Dec 2007 01:50:50 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 68A4613C459; Tue, 18 Dec 2007 01:50:50 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lBI1ooH1097685; Tue, 18 Dec 2007 01:50:50 GMT (envelope-from sobomax@repoman.freebsd.org) Received: (from sobomax@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lBI1ooK9097684; Tue, 18 Dec 2007 01:50:50 GMT (envelope-from sobomax) Message-Id: <200712180150.lBI1ooK9097684@repoman.freebsd.org> From: Maxim Sobolev Date: Tue, 18 Dec 2007 01:50:50 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/lib/libstand bzipfs.c gzipfs.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2007 01:50:50 -0000 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