This is the mail archive of the
mailing list for the Cygwin project.
Re: [PATCH] Don't silently ignore corrupt bz2 files
- From: Christopher Faylor <cgf-use-the-mailinglist-please at cygwin dot com>
- To: cygwin-apps at cygwin dot com
- Date: Thu, 4 Nov 2010 16:17:57 -0400
- Subject: Re: [PATCH] Don't silently ignore corrupt bz2 files
- References: <4CD30C52.email@example.com>
- Reply-to: cygwin-apps at cygwin dot com
On Thu, Nov 04, 2010 at 07:41:06PM +0000, Jon TURNEY wrote:
>As I discovered today whilst trying to test some other modifications to
>setup.exe, it currently silently decompresses a corrupt setup.bz2 into a zero
>This should only cause problems if signature checking is disabled, or if the
>bz2 file got corrupted before it was signed.
>From a905bdbc2d61d375927c98f65e68b69f220fcffb Mon Sep 17 00:00:00 2001
>From: Jon TURNEY <firstname.lastname@example.org>
>Date: Thu, 4 Nov 2010 18:34:13 +0000
>Subject: [PATCH] Don't silently ignore corrupt bz2 files
>(This should only be a problem when either signatures are ignored,
>or the setup.bz2 is corrupted before being signed)
>Return 0 indicating EOF when decompressing bz, after bzDecompress returns
>BZ_STREAM_END, rather than continue to try to call bzDecompress beyond the
>end of the compressed data, generating a BZ_SEQUENCE_ERROR.
>Detect if an error occurred decompressing the ini file, and report it.
> ChangeLog | 10 ++++++++++
> compress_bz.cc | 4 ++++
> compress_bz.h | 1 +
> ini.cc | 10 +++++-----
> 4 files changed, 20 insertions(+), 5 deletions(-)
>diff --git a/ChangeLog b/ChangeLog
>index 8448885..d8193ab 100644
>@@ -1,3 +1,13 @@
>+2010-11-04 Jon TURNEY <email@example.com>
>+ * compress_bz.h (compress): Add endReached flag.
>+ * compress_bz.cc (read, compress_bz): Use endReached flag to return 0
>+ for a read when EOF has been reached, after BZ2_bzDecompress returns
>+ BZ_STREAM_END, rather than continue to try to call BZ2_bzDecompress
>+ beyond the end of the compressed data, generating a BZ_SEQUENCE_ERROR.
>+ * ini.cc (do_remote_ini): Now that bz2_stream doesn't always have a
>+ spurious error, detect and report if an error occurred decompressing.
Please don't send ChangeLog's as diffs but otherwise, this looks good. Please