Merge bzip2 1.0.8
1.0.7 (27 Jun 19) ~~~~~~~~~~~~~~~~~ * Fix undefined behavior in the macros SET_BH, CLEAR_BH, & ISSET_BH * bzip2: Fix return value when combining --test,-t and -q. * bzip2recover: Fix buffer overflow for large argv[0] * bzip2recover: Fix use after free issue with outFile (CVE-2016-3189) * Make sure nSelectors is not out of range (CVE-2019-12900) 1.0.8 (13 Jul 19) ~~~~~~~~~~~~~~~~~ * Accept as many selectors as the file format allows. This relaxes the fix for CVE-2019-12900 from 1.0.7 so that bzip2 allows decompression of bz2 files that use (too) many selectors again. * Fix handling of large (> 4GB) files on Windows. * Cleanup of bzdiff and bzgrep scripts so they don't use any bash extensions and handle multiple archives correctly. * There is now a bz2-files testsuite at https://sourceware.org/git/bzip2-tests.git
This commit is contained in:
parent
7ea9bb0be0
commit
c4f47eb4fb
|
@ -1,31 +1,40 @@
|
|||
.\" $NetBSD: bzip2.1,v 1.3 2012/05/07 00:45:47 wiz Exp $
|
||||
.\" $NetBSD: bzip2.1,v 1.4 2019/07/21 11:52:14 maya Exp $
|
||||
.\"
|
||||
.Dd May 14, 2010
|
||||
.Dt BZIP2 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm bzip2 ,
|
||||
.Nm bunzip2 ,
|
||||
.Nm bzcat ,
|
||||
.Nm bzip2recover
|
||||
.Nd block-sorting file compressor
|
||||
.Sh SYNOPSIS
|
||||
.Nm bzip2
|
||||
.Op Fl 123456789cdfkLqstVvz
|
||||
.Op Ar filename Ar
|
||||
.Pp
|
||||
.Nm bunzip2
|
||||
.Op Fl fkLVvs
|
||||
.Op Ar filename Ar
|
||||
.Pp
|
||||
.Nm bzcat
|
||||
.Op Fl s
|
||||
.Op Ar filename Ar
|
||||
.Pp
|
||||
.Nm bzip2recover
|
||||
.Ar filename
|
||||
.Sh DESCRIPTION
|
||||
.Nm bzip2
|
||||
.PU
|
||||
.TH bzip2 1
|
||||
.SH NAME
|
||||
bzip2, bunzip2 \- a block-sorting file compressor, v1.0.8
|
||||
.br
|
||||
bzcat \- decompresses files to stdout
|
||||
.br
|
||||
bzip2recover \- recovers data from damaged bzip2 files
|
||||
|
||||
.SH SYNOPSIS
|
||||
.ll +8
|
||||
.B bzip2
|
||||
.RB [ " \-cdfkqstvzVL123456789 " ]
|
||||
[
|
||||
.I "filenames \&..."
|
||||
]
|
||||
.ll -8
|
||||
.br
|
||||
.B bunzip2
|
||||
.RB [ " \-fkvsVL " ]
|
||||
[
|
||||
.I "filenames \&..."
|
||||
]
|
||||
.br
|
||||
.B bzcat
|
||||
.RB [ " \-s " ]
|
||||
[
|
||||
.I "filenames \&..."
|
||||
]
|
||||
.br
|
||||
.B bzip2recover
|
||||
.I "filename"
|
||||
|
||||
.SH DESCRIPTION
|
||||
.I bzip2
|
||||
compresses files using the Burrows-Wheeler block sorting
|
||||
text compression algorithm, and Huffman coding.
|
||||
Compression is generally considerably better than that achieved by
|
||||
|
@ -486,25 +495,51 @@ I/O error messages are not as helpful as they could be.
|
|||
.Nm bzip2
|
||||
tries hard to detect I/O errors and exit cleanly, but the details of
|
||||
what the problem is sometimes seem rather misleading.
|
||||
.Pp
|
||||
This manual page pertains to version 1.0.6 of
|
||||
.Nm bzip2 .
|
||||
|
||||
This manual page pertains to version 1.0.8 of
|
||||
.I bzip2.
|
||||
Compressed data created by this version is entirely forwards and
|
||||
backwards compatible with the previous public releases, versions
|
||||
0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, 1.0.2 and above, but with the
|
||||
following exception: 0.9.0 and above can correctly decompress multiple
|
||||
concatenated compressed files.
|
||||
0.1pl2 cannot do this; it will stop after decompressing just the first
|
||||
file in the stream.
|
||||
.Pp
|
||||
.Nm bzip2recover
|
||||
versions prior to 1.0.2 used 32-bit integers to represent bit
|
||||
positions in compressed files, so they could not handle compressed
|
||||
files more than 512 megabytes long.
|
||||
Versions 1.0.2 and above use 64-bit ints on some platforms which
|
||||
support them (GNU supported targets, and Windows).
|
||||
To establish whether or not
|
||||
.Nm bzip2recover
|
||||
was built with such a limitation, run it without arguments.
|
||||
In any event you can build yourself an unlimited version if you can
|
||||
recompile it with MaybeUInt64 set to be an unsigned 64-bit integer.
|
||||
0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, 1.0.2 and above, but with the following
|
||||
exception: 0.9.0 and above can correctly decompress multiple
|
||||
concatenated compressed files. 0.1pl2 cannot do this; it will stop
|
||||
after decompressing just the first file in the stream.
|
||||
|
||||
.I bzip2recover
|
||||
versions prior to 1.0.2 used 32-bit integers to represent
|
||||
bit positions in compressed files, so they could not handle compressed
|
||||
files more than 512 megabytes long. Versions 1.0.2 and above use
|
||||
64-bit ints on some platforms which support them (GNU supported
|
||||
targets, and Windows). To establish whether or not bzip2recover was
|
||||
built with such a limitation, run it without arguments. In any event
|
||||
you can build yourself an unlimited version if you can recompile it
|
||||
with MaybeUInt64 set to be an unsigned 64-bit integer.
|
||||
|
||||
|
||||
|
||||
.SH AUTHOR
|
||||
Julian Seward, jseward@acm.org.
|
||||
|
||||
https://sourceware.org/bzip2/
|
||||
|
||||
The ideas embodied in
|
||||
.I bzip2
|
||||
are due to (at least) the following
|
||||
people: Michael Burrows and David Wheeler (for the block sorting
|
||||
transformation), David Wheeler (again, for the Huffman coder), Peter
|
||||
Fenwick (for the structured coding model in the original
|
||||
.I bzip,
|
||||
and many refinements), and Alistair Moffat, Radford Neal and Ian Witten
|
||||
(for the arithmetic coder in the original
|
||||
.I bzip).
|
||||
I am much
|
||||
indebted for their help, support and advice. See the manual in the
|
||||
source distribution for pointers to sources of documentation. Christian
|
||||
von Roques encouraged me to look for faster sorting algorithms, so as to
|
||||
speed up compression. Bela Lubkin encouraged me to improve the
|
||||
worst-case compression performance.
|
||||
Donna Robinson XMLised the documentation.
|
||||
The bz* scripts are derived from those of GNU gzip.
|
||||
Many people sent patches, helped
|
||||
with portability problems, lent machines, gave advice and were generally
|
||||
helpful.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bzip2.c,v 1.4 2013/10/20 03:14:21 christos Exp $ */
|
||||
/* $NetBSD: bzip2.c,v 1.5 2019/07/21 11:52:14 maya Exp $ */
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -9,8 +9,8 @@
|
|||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
||||
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
@ -130,12 +130,12 @@
|
|||
#if BZ_LCCWIN32
|
||||
# include <io.h>
|
||||
# include <fcntl.h>
|
||||
# include <sys\stat.h>
|
||||
# include <sys/stat.h>
|
||||
|
||||
# define NORETURN /**/
|
||||
# define PATH_SEP '\\'
|
||||
# define MY_LSTAT _stat
|
||||
# define MY_STAT _stat
|
||||
# define MY_LSTAT _stati64
|
||||
# define MY_STAT _stati64
|
||||
# define MY_S_ISREG(x) ((x) & _S_IFREG)
|
||||
# define MY_S_ISDIR(x) ((x) & _S_IFDIR)
|
||||
|
||||
|
@ -751,8 +751,8 @@ void panic ( const Char* s )
|
|||
fprintf ( stderr,
|
||||
"\n%s: PANIC -- internal consistency error:\n"
|
||||
"\t%s\n"
|
||||
"\tThis is a BUG. Please report it to me at:\n"
|
||||
"\tjseward@bzip.org\n",
|
||||
"\tThis is a BUG. Please report it to:\n"
|
||||
"\tbzip2-devel@sourceware.org\n",
|
||||
progName, s );
|
||||
showFileNames();
|
||||
cleanUpAndFail( 3 );
|
||||
|
@ -833,7 +833,7 @@ void mySIGSEGVorSIGBUScatcher ( IntNative n )
|
|||
" The user's manual, Section 4.3, has more info on (1) and (2).\n"
|
||||
" \n"
|
||||
" If you suspect this is a bug in bzip2, or are unsure about (1)\n"
|
||||
" or (2), feel free to report it to me at: jseward@bzip.org.\n"
|
||||
" or (2), feel free to report it to: bzip2-devel@sourceware.org.\n"
|
||||
" Section 4.3 of the user's manual describes the info a useful\n"
|
||||
" bug report should have. If the manual is available on your\n"
|
||||
" system, please try and read it before mailing me. If you don't\n"
|
||||
|
@ -856,7 +856,7 @@ void mySIGSEGVorSIGBUScatcher ( IntNative n )
|
|||
" The user's manual, Section 4.3, has more info on (2) and (3).\n"
|
||||
" \n"
|
||||
" If you suspect this is a bug in bzip2, or are unsure about (2)\n"
|
||||
" or (3), feel free to report it to me at: jseward@bzip.org.\n"
|
||||
" or (3), feel free to report it to: bzip2-devel@sourceware.org.\n"
|
||||
" Section 4.3 of the user's manual describes the info a useful\n"
|
||||
" bug report should have. If the manual is available on your\n"
|
||||
" system, please try and read it before mailing me. If you don't\n"
|
||||
|
@ -1610,11 +1610,11 @@ void license ( void )
|
|||
"bzip2, a block-sorting file compressor. "
|
||||
"Version %s.\n"
|
||||
" \n"
|
||||
" Copyright (C) 1996-2010 by Julian Seward.\n"
|
||||
" Copyright (C) 1996-2019 by Julian Seward.\n"
|
||||
" \n"
|
||||
" This program is free software; you can redistribute it and/or modify\n"
|
||||
" it under the terms set out in the LICENSE file, which is included\n"
|
||||
" in the bzip2-1.0.6 source distribution.\n"
|
||||
" in the bzip2 source distribution.\n"
|
||||
" \n"
|
||||
" This program is distributed in the hope that it will be useful,\n"
|
||||
" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
||||
|
@ -2010,12 +2010,14 @@ IntNative main ( IntNative argc, Char *argv[] )
|
|||
testf ( aa->name );
|
||||
}
|
||||
}
|
||||
if (testFailsExist && noisy) {
|
||||
fprintf ( stderr,
|
||||
"\n"
|
||||
"You can use the `bzip2recover' program to attempt to recover\n"
|
||||
"data from undamaged sections of corrupted files.\n\n"
|
||||
);
|
||||
if (testFailsExist) {
|
||||
if (noisy) {
|
||||
fprintf ( stderr,
|
||||
"\n"
|
||||
"You can use the `bzip2recover' program to attempt to recover\n"
|
||||
"data from undamaged sections of corrupted files.\n\n"
|
||||
);
|
||||
}
|
||||
setExit(2);
|
||||
exit(exitValue);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bzip2recover.c,v 1.4 2019/03/06 07:21:55 martin Exp $ */
|
||||
/* $NetBSD: bzip2recover.c,v 1.5 2019/07/21 11:52:14 maya Exp $ */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
/*--- Block recoverer program for bzip2 ---*/
|
||||
|
@ -9,8 +9,8 @@
|
|||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
||||
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
@ -324,11 +324,12 @@ Int32 main ( Int32 argc, Char** argv )
|
|||
UInt32 buffHi, buffLo, blockCRC;
|
||||
Char* p;
|
||||
|
||||
strcpy ( progName, argv[0] );
|
||||
strncpy ( progName, argv[0], BZ_MAX_FILENAME-1);
|
||||
progName[BZ_MAX_FILENAME-1]='\0';
|
||||
inFileName[0] = outFileName[0] = 0;
|
||||
|
||||
fprintf ( stderr,
|
||||
"bzip2recover 1.0.6: extracts blocks from damaged .bz2 files.\n" );
|
||||
"bzip2recover 1.0.8: extracts blocks from damaged .bz2 files.\n" );
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf ( stderr, "%s: usage is `%s damaged_file_name'.\n",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bzlib.c,v 1.3 2012/05/07 00:45:47 wiz Exp $ */
|
||||
/* $NetBSD: bzlib.c,v 1.4 2019/07/21 11:52:14 maya Exp $ */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
|
@ -10,8 +10,8 @@
|
|||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
||||
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
@ -45,12 +45,12 @@ void BZ2_bz__AssertH__fail ( int errcode )
|
|||
fprintf(stderr,
|
||||
"\n\nbzip2/libbzip2: internal error number %d.\n"
|
||||
"This is a bug in bzip2/libbzip2, %s.\n"
|
||||
"Please report it to me at: jseward@bzip.org. If this happened\n"
|
||||
"Please report it to: bzip2-devel@sourceware.org. If this happened\n"
|
||||
"when you were using some program which uses libbzip2 as a\n"
|
||||
"component, you should also report this bug to the author(s)\n"
|
||||
"of that program. Please make an effort to report this bug;\n"
|
||||
"timely and accurate bug reports eventually lead to higher\n"
|
||||
"quality software. Thanks. Julian Seward, 10 December 2007.\n\n",
|
||||
"quality software. Thanks.\n\n",
|
||||
errcode,
|
||||
BZ2_bzlibVersion()
|
||||
);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bzlib_private.h,v 1.3 2012/05/07 00:45:47 wiz Exp $ */
|
||||
/* $NetBSD: bzlib_private.h,v 1.4 2019/07/21 11:52:14 maya Exp $ */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
|
@ -10,8 +10,8 @@
|
|||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
||||
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
/*-- General stuff. --*/
|
||||
|
||||
#define BZ_VERSION "1.0.6, 6-Sept-2010"
|
||||
#define BZ_VERSION "1.0.8, 13-Jul-2019"
|
||||
|
||||
typedef char Char;
|
||||
typedef unsigned char Bool;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: decompress.c,v 1.3 2012/05/07 00:45:48 wiz Exp $ */
|
||||
/* $NetBSD: decompress.c,v 1.4 2019/07/21 11:52:14 maya Exp $ */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
|
@ -10,8 +10,8 @@
|
|||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
||||
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
@ -287,7 +287,7 @@ Int32 BZ2_decompress ( DState* s )
|
|||
|
||||
/*--- Now the selectors ---*/
|
||||
GET_BITS(BZ_X_SELECTOR_1, nGroups, 3);
|
||||
if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR);
|
||||
if (nGroups < 2 || nGroups > BZ_N_GROUPS) RETURN(BZ_DATA_ERROR);
|
||||
GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15);
|
||||
if (nSelectors < 1) RETURN(BZ_DATA_ERROR);
|
||||
for (i = 0; i < nSelectors; i++) {
|
||||
|
@ -298,8 +298,14 @@ Int32 BZ2_decompress ( DState* s )
|
|||
j++;
|
||||
if (j >= nGroups) RETURN(BZ_DATA_ERROR);
|
||||
}
|
||||
s->selectorMtf[i] = j;
|
||||
/* Having more than BZ_MAX_SELECTORS doesn't make much sense
|
||||
since they will never be used, but some implementations might
|
||||
"round up" the number of selectors, so just ignore those. */
|
||||
if (i < BZ_MAX_SELECTORS)
|
||||
s->selectorMtf[i] = j;
|
||||
}
|
||||
if (nSelectors > BZ_MAX_SELECTORS)
|
||||
nSelectors = BZ_MAX_SELECTORS;
|
||||
|
||||
/*--- Undo the MTF values for the selectors. ---*/
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue