diff --git a/CHANGES b/CHANGES index 81e97ca6fa..30afead258 100644 --- a/CHANGES +++ b/CHANGES @@ -2,8 +2,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 + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -325,3 +325,32 @@ Security fix only. Fixes CERT-FI 20469 as it applies to bzip2. Izdebski. * Make the documentation build on Ubuntu 10.04 + +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 diff --git a/LICENSE b/LICENSE index cc614178cf..81a37eab7a 100644 --- a/LICENSE +++ b/LICENSE @@ -2,7 +2,7 @@ -------------------------------------------------------------------------- This program, "bzip2", the associated library "libbzip2", and all -documentation, are copyright (C) 1996-2010 Julian R Seward. All +documentation, are copyright (C) 1996-2019 Julian R Seward. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -36,7 +36,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -Julian Seward, jseward@bzip.org -bzip2/libbzip2 version 1.0.6 of 6 September 2010 +Julian Seward, jseward@acm.org +bzip2/libbzip2 version 1.0.8 of 13 July 2019 -------------------------------------------------------------------------- diff --git a/Makefile b/Makefile index 9754ddf286..f8a17722e1 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,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 +# bzip2/libbzip2 version 1.0.8 of 13 July 2019 +# Copyright (C) 1996-2019 Julian Seward # # Please read the WARNING, DISCLAIMER and PATENTS sections in the # README file. @@ -137,7 +137,7 @@ bzip2recover.o: bzip2recover.c distclean: clean rm -f manual.ps manual.html manual.pdf -DISTNAME=bzip2-1.0.6 +DISTNAME=bzip2-1.0.8 dist: check manual rm -f $(DISTNAME) ln -s -f . $(DISTNAME) diff --git a/Makefile-libbz2_so b/Makefile-libbz2_so index e58791b3b3..fb0f2306f0 100644 --- a/Makefile-libbz2_so +++ b/Makefile-libbz2_so @@ -1,6 +1,6 @@ # This Makefile builds a shared version of the library, -# libbz2.so.1.0.6, with soname libbz2.so.1.0, +# libbz2.so.1.0.8, with soname libbz2.so.1.0, # at least on x86-Linux (RedHat 7.2), # with gcc-2.96 20000731 (Red Hat Linux 7.1 2.96-98). # Please see the README file for some important info @@ -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 +# bzip2/libbzip2 version 1.0.8 of 13 July 2019 +# Copyright (C) 1996-2019 Julian Seward # # Please read the WARNING, DISCLAIMER and PATENTS sections in the # README file. @@ -35,13 +35,13 @@ OBJS= blocksort.o \ bzlib.o all: $(OBJS) - $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS) - $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.6 + $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.8 $(OBJS) + $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.8 rm -f libbz2.so.1.0 - ln -s libbz2.so.1.0.6 libbz2.so.1.0 + ln -s libbz2.so.1.0.8 libbz2.so.1.0 clean: - rm -f $(OBJS) bzip2.o libbz2.so.1.0.6 libbz2.so.1.0 bzip2-shared + rm -f $(OBJS) bzip2.o libbz2.so.1.0.8 libbz2.so.1.0 bzip2-shared blocksort.o: blocksort.c $(CC) $(CFLAGS) -c blocksort.c diff --git a/README b/README index 9fb0f63601..b9c6099fd1 100644 --- a/README +++ b/README @@ -6,8 +6,8 @@ This version is fully compatible with the previous public releases. 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 +bzip2/libbzip2 version 1.0.8 of 13 July 2019 +Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in this file. @@ -73,7 +73,7 @@ HOW TO BUILD -- Windows 95, NT, DOS, Mac, etc. It's difficult for me to support compilation on all these platforms. My approach is to collect binaries for these platforms, and put them -on the master web site (http://www.bzip.org). Look there. However +on the master web site (https://sourceware.org/bzip2/). Look there. However (FWIW), bzip2-1.0.X is very standard ANSI C and should compile unmodified with MS Visual C. If you have difficulties building, you might want to read README.COMPILATION.PROBLEMS. @@ -161,43 +161,22 @@ WHAT'S NEW IN 0.9.5 ? * Many small improvements in file and flag handling. * A Y2K statement. -WHAT'S NEW IN 1.0.0 ? +WHAT'S NEW IN 1.0.x ? See the CHANGES file. -WHAT'S NEW IN 1.0.2 ? - - See the CHANGES file. - -WHAT'S NEW IN 1.0.3 ? - - See the CHANGES file. - -WHAT'S NEW IN 1.0.4 ? - - See the CHANGES file. - -WHAT'S NEW IN 1.0.5 ? - - See the CHANGES file. - -WHAT'S NEW IN 1.0.6 ? - - See the CHANGES file. - - -I hope you find bzip2 useful. Feel free to contact me at - jseward@bzip.org +I hope you find bzip2 useful. Feel free to contact the developers at + bzip2-devel@sourceware.org if you have any suggestions or queries. Many people mailed me with comments, suggestions and patches after the releases of bzip-0.15, bzip-0.21, and bzip2 versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, 1.0.2 and 1.0.3, and the changes in bzip2 are largely a result of this feedback. I thank you for your comments. -bzip2's "home" is http://www.bzip.org/ +bzip2's "home" is https://sourceware.org/bzip2/ Julian Seward -jseward@bzip.org +jseward@acm.org Cambridge, UK. 18 July 1996 (version 0.15) @@ -213,3 +192,5 @@ Cambridge, UK. 20 December 2006 (bzip2, version 1.0.4) 10 December 2007 (bzip2, version 1.0.5) 6 Sept 2010 (bzip2, version 1.0.6) +27 June 2019 (bzip2, version 1.0.7) +13 July 2019 (bzip2, version 1.0.8) diff --git a/README.COMPILATION.PROBLEMS b/README.COMPILATION.PROBLEMS index 667d0d6dfe..fa317a50c8 100644 --- a/README.COMPILATION.PROBLEMS +++ b/README.COMPILATION.PROBLEMS @@ -2,8 +2,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 +bzip2/libbzip2 version 1.0.8 of 13 July 2019 +Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -12,7 +12,7 @@ This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ -bzip2-1.0.6 should compile without problems on the vast majority of +bzip2 should compile without problems on the vast majority of platforms. Using the supplied Makefile, I've built and tested it myself for x86-linux and amd64-linux. With makefile.msc, Visual C++ 6.0 and nmake, you can build a native Win32 version too. Large file diff --git a/README.XML.STUFF b/README.XML.STUFF index 3a57f3fa89..1503476ebe 100644 --- a/README.XML.STUFF +++ b/README.XML.STUFF @@ -2,8 +2,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 + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. diff --git a/blocksort.c b/blocksort.c index d0d662cd4e..92d81fe287 100644 --- a/blocksort.c +++ b/blocksort.c @@ -8,8 +8,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 + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -202,9 +202,9 @@ void fallbackQSort3 ( UInt32* fmap, bhtab [ 0 .. 2+(nblock/32) ] destroyed */ -#define SET_BH(zz) bhtab[(zz) >> 5] |= (1 << ((zz) & 31)) -#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31)) -#define ISSET_BH(zz) (bhtab[(zz) >> 5] & (1 << ((zz) & 31))) +#define SET_BH(zz) bhtab[(zz) >> 5] |= ((UInt32)1 << ((zz) & 31)) +#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~((UInt32)1 << ((zz) & 31)) +#define ISSET_BH(zz) (bhtab[(zz) >> 5] & ((UInt32)1 << ((zz) & 31))) #define WORD_BH(zz) bhtab[(zz) >> 5] #define UNALIGNED_BH(zz) ((zz) & 0x01f) diff --git a/bz-html.xsl b/bz-html.xsl index 1785fffbc9..b6000d586d 100644 --- a/bz-html.xsl +++ b/bz-html.xsl @@ -7,11 +7,14 @@ - - + + - - + + + +link rel="stylesheet" type="text/css" href="bzip.css" /> + diff --git a/bzdiff b/bzdiff old mode 100644 new mode 100755 index 6fc38f92d2..bd96c27c39 --- a/bzdiff +++ b/bzdiff @@ -37,10 +37,6 @@ if test -z "$FILES"; then echo "Usage: $prog [${comp}_options] file [file]" exit 1 fi -tmp=`mktemp ${TMPDIR:-/tmp}/bzdiff.XXXXXXXXXX` || { - echo 'cannot create a temporary file' >&2 - exit 1 -} set $FILES if test $# -eq 1; then FILE=`echo "$1" | sed 's/.bz2$//'` @@ -53,10 +49,14 @@ elif test $# -eq 2; then case "$2" in *.bz2) F=`echo "$2" | sed 's|.*/||;s|.bz2$||'` - bzip2 -cdfq "$2" > $tmp - bzip2 -cdfq "$1" | $comp $OPTIONS - $tmp + tmp=`mktemp "${TMPDIR:-/tmp}"/bzdiff.XXXXXXXXXX` || { + echo 'cannot create a temporary file' >&2 + exit 1 + } + bzip2 -cdfq "$2" > "$tmp" + bzip2 -cdfq "$1" | $comp $OPTIONS - "$tmp" STAT="$?" - /bin/rm -f $tmp;; + /bin/rm -f "$tmp";; *) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2" STAT="$?";; @@ -69,8 +69,8 @@ elif test $# -eq 2; then STAT="$?";; esac;; esac - exit "$STAT" else echo "Usage: $prog [${comp}_options] file [file]" exit 1 fi +exit "$STAT" diff --git a/bzgrep b/bzgrep old mode 100644 new mode 100755 index 9a04b8337d..0314ca6038 --- a/bzgrep +++ b/bzgrep @@ -63,12 +63,22 @@ for i do bzip2 -cdfq "$i" | $grep $opt "$pat" r=$? else - j=${i//\\/\\\\} - j=${j//|/\\|} - j=${j//&/\\&} + j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g') j=`printf "%s" "$j" | tr '\n' ' '` - bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|" - r=$? + # A trick adapted from + # https://groups.google.com/forum/#!original/comp.unix.shell/x1345iu10eg/Nn1n-1r1uU0J + # that has the same effect as the following bash code: + # bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|" + # r=${PIPESTATUS[1]} + exec 3>&1 + eval ` + exec 4>&1 >&3 3>&- + { + bzip2 -cdfq "$i" 4>&- + } | { + $grep $opt "$pat" 4>&-; echo "r=$?;" >&4 + } | sed "s|^|${j}:|" + ` fi test "$r" -ne 0 && res="$r" done diff --git a/bzip.css b/bzip.css index 43193d8db0..211311838d 100644 --- a/bzip.css +++ b/bzip.css @@ -25,7 +25,7 @@ dd { /* -- ruler -- */ div.hr_blue { height: 3px; - background:#ffffff url("/images/hr_blue.png") repeat-x; } + background:#ffffff url("../images/hr_blue.png") repeat-x; } div.hr_blue hr { display:none; } /* release styles */ @@ -38,7 +38,7 @@ div.hr_blue hr { display:none; } ul { margin: 0px 4px 16px 16px; padding: 0px; - list-style: url("/images/li-blue.png"); + list-style: url("../images/li-blue.png"); } ul li { margin-bottom: 10px; diff --git a/bzip2.1 b/bzip2.1 index ce3a78e6b4..0cbcdab00e 100644 --- a/bzip2.1 +++ b/bzip2.1 @@ -1,7 +1,7 @@ .PU .TH bzip2 1 .SH NAME -bzip2, bunzip2 \- a block-sorting file compressor, v1.0.6 +bzip2, bunzip2 \- a block-sorting file compressor, v1.0.8 .br bzcat \- decompresses files to stdout .br @@ -405,7 +405,7 @@ I/O error messages are not as helpful as they could be. tries hard to detect I/O errors and exit cleanly, but the details of what the problem is sometimes seem rather misleading. -This manual page pertains to version 1.0.6 of +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 @@ -427,9 +427,9 @@ with MaybeUInt64 set to be an unsigned 64-bit integer. .SH AUTHOR -Julian Seward, jsewardbzip.org. +Julian Seward, jseward@acm.org. -http://www.bzip.org +https://sourceware.org/bzip2/ The ideas embodied in .I bzip2 diff --git a/bzip2.1.preformatted b/bzip2.1.preformatted index 63c33be99e..787f1c6145 100644 --- a/bzip2.1.preformatted +++ b/bzip2.1.preformatted @@ -3,7 +3,7 @@ bzip2(1) bzip2(1) NNAAMMEE - bzip2, bunzip2 − a block‐sorting file compressor, v1.0.6 + bzip2, bunzip2 − a block‐sorting file compressor, v1.0.8 bzcat − decompresses files to stdout bzip2recover − recovers data from damaged bzip2 files @@ -348,7 +348,7 @@ CCAAVVEEAATTSS but the details of what the problem is sometimes seem rather misleading. - This manual page pertains to version 1.0.6 of _b_z_i_p_2_. Com­ + This manual page pertains to version 1.0.8 of _b_z_i_p_2_. Com­ pressed 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, @@ -372,9 +372,9 @@ CCAAVVEEAATTSS AAUUTTHHOORR - Julian Seward, jsewardbzip.org. + Julian Seward, jseward@acm.org. - http://www.bzip.org + https://sourceware.org/bzip2/ The ideas embodied in _b_z_i_p_2 are due to (at least) the fol­ lowing people: Michael Burrows and David Wheeler (for the diff --git a/bzip2.c b/bzip2.c index 6de9d1d148..d95d280619 100644 --- a/bzip2.c +++ b/bzip2.c @@ -7,8 +7,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 + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -128,12 +128,12 @@ #if BZ_LCCWIN32 # include # include -# include +# include # 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) @@ -554,7 +554,7 @@ static Bool testStream ( FILE *zStream ) { BZFILE* bzf = NULL; - Int32 bzerr, bzerr_dummy, ret, nread, streamNo, i; + Int32 bzerr, bzerr_dummy, ret, streamNo, i; UChar obuf[5000]; UChar unused[BZ_MAX_UNUSED]; Int32 nUnused; @@ -577,7 +577,7 @@ Bool testStream ( FILE *zStream ) streamNo++; while (bzerr == BZ_OK) { - nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 ); + BZ2_bzRead ( &bzerr, bzf, obuf, 5000 ); if (bzerr == BZ_DATA_ERROR_MAGIC) goto errhandler; } if (bzerr != BZ_STREAM_END) goto errhandler; @@ -748,8 +748,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 ); @@ -829,7 +829,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" @@ -852,7 +852,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" @@ -1605,11 +1605,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" @@ -2003,12 +2003,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); } diff --git a/bzip2.txt b/bzip2.txt index d2deb39491..a50570bc2f 100644 --- a/bzip2.txt +++ b/bzip2.txt @@ -1,6 +1,6 @@ NAME - bzip2, bunzip2 - a block-sorting file compressor, v1.0.6 + bzip2, bunzip2 - a block-sorting file compressor, v1.0.8 bzcat - decompresses files to stdout bzip2recover - recovers data from damaged bzip2 files @@ -345,7 +345,7 @@ CAVEATS but the details of what the problem is sometimes seem rather misleading. - This manual page pertains to version 1.0.6 of bzip2. Com- + This manual page pertains to version 1.0.8 of bzip2. Com- pressed 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, @@ -367,9 +367,9 @@ CAVEATS AUTHOR - Julian Seward, jsewardbzip.org. + Julian Seward, jseward@acm.org - http://www.bzip.org + https://sourceware.org/bzip2/ The ideas embodied in bzip2 are due to (at least) the fol- lowing people: Michael Burrows and David Wheeler (for the diff --git a/bzip2recover.c b/bzip2recover.c index f9de0496ab..a8131e0611 100644 --- a/bzip2recover.c +++ b/bzip2recover.c @@ -7,8 +7,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 + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -309,11 +309,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", @@ -457,6 +458,7 @@ Int32 main ( Int32 argc, Char** argv ) bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 ); bsPutUInt32 ( bsWr, blockCRC ); bsClose ( bsWr ); + outFile = NULL; } if (wrBlock >= rbCtr) break; wrBlock++; diff --git a/bzlib.c b/bzlib.c index bd358a793b..21786551b6 100644 --- a/bzlib.c +++ b/bzlib.c @@ -8,8 +8,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 + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -43,12 +43,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() ); diff --git a/bzlib.h b/bzlib.h index 8277123da8..8966a6c580 100644 --- a/bzlib.h +++ b/bzlib.h @@ -8,8 +8,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 + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. diff --git a/bzlib_private.h b/bzlib_private.h index 5d0217f463..3755a6f701 100644 --- a/bzlib_private.h +++ b/bzlib_private.h @@ -8,8 +8,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 + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -36,7 +36,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; diff --git a/compress.c b/compress.c index caf7696011..5dfa00231b 100644 --- a/compress.c +++ b/compress.c @@ -8,8 +8,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 + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -454,7 +454,7 @@ void sendMTFValues ( EState* s ) AssertH( nGroups < 8, 3002 ); AssertH( nSelectors < 32768 && - nSelectors <= (2 + (900000 / BZ_G_SIZE)), + nSelectors <= BZ_MAX_SELECTORS, 3003 ); diff --git a/crctable.c b/crctable.c index 1fea7e946c..2b33c25353 100644 --- a/crctable.c +++ b/crctable.c @@ -8,8 +8,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 + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. diff --git a/decompress.c b/decompress.c index 311f5668f9..a1a0bac892 100644 --- a/decompress.c +++ b/decompress.c @@ -8,8 +8,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 + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -285,7 +285,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++) { @@ -296,8 +296,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. ---*/ { diff --git a/entities.xml b/entities.xml index 4b28f34659..dd699246f9 100644 --- a/entities.xml +++ b/entities.xml @@ -1,9 +1,10 @@ - - - + + + + - - + + diff --git a/format.pl b/format.pl old mode 100644 new mode 100755 index f169fd9de2..2734dede19 --- a/format.pl +++ b/format.pl @@ -4,8 +4,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 +# bzip2/libbzip2 version 1.0.8 of 13 July 2019 +# Copyright (C) 1996-2019 Julian Seward # # Please read the WARNING, DISCLAIMER and PATENTS sections in the # README file. diff --git a/huffman.c b/huffman.c index 2283fdbc5a..43a1899e46 100644 --- a/huffman.c +++ b/huffman.c @@ -8,8 +8,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 + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. diff --git a/manual.html b/manual.html index f59427f7f0..2afa6780b9 100644 --- a/manual.html +++ b/manual.html @@ -1,9 +1,10 @@ - -bzip2 and libbzip2, version 1.0.6 - - -
+

-bzip2 and libbzip2, version 1.0.6

+bzip2 and libbzip2, version 1.0.8

A program and library for data compression

Julian Seward

-
http://www.bzip.org
+
https://sourceware.org/bzip2/
-

Version 1.0.6 of 6 September 2010

-
-
-

This program, bzip2, the +

Version 1.0.8 of 13 July 2019

+
+
+

This program, bzip2, the associated library libbzip2, and - all documentation, are copyright 1996-2010 Julian Seward. + all documentation, are copyright © 1996-2019 Julian Seward. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

-
    +
    • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

    • @@ -142,7 +143,7 @@

    Table of Contents

    -
    +
    1. Introduction
    2. How to use bzip2
    @@ -211,9 +212,9 @@

    -
    -

    -1.Introduction

    +
    +

    +1. Introduction

    bzip2 compresses files using the Burrows-Wheeler block-sorting text compression algorithm, and Huffman coding. Compression is generally @@ -228,24 +229,24 @@

    library interface. Most of the manual is devoted to this library, not the program, which is good news if your interest is only in the program.

    -
    -
    -

    -2.How to use bzip2

    +
    +

    +2. How to use bzip2

    Table of Contents

    -
    +
    2.1. NAME
    2.2. SYNOPSIS
    2.3. DESCRIPTION
    @@ -260,23 +261,23 @@

    This chapter contains a copy of the bzip2 man page, and nothing else.

    -
    +

    -2.1.NAME

    -
      +2.1. NAME

    +
    • bzip2, bunzip2 - a block-sorting file - compressor, v1.0.6

    • + compressor, v1.0.8

    • bzcat - decompresses files to stdout

    • bzip2recover - recovers data from damaged bzip2 files

    -
    +

    -2.2.SYNOPSIS

    -
      +2.2. SYNOPSIS
    +
    • bzip2 [ -cdfkqstvzVL123456789 ] [ filenames ... ]

    • bunzip2 [ @@ -287,9 +288,9 @@

      filename

    -
    +

    -2.3.DESCRIPTION

    +2.3. DESCRIPTION

bzip2 compresses files using the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding. Compression is generally @@ -329,7 +330,7 @@

bzip2 attempts to guess the filename for the decompressed file from that of the compressed file as follows:

-
    +
    • filename.bz2 becomes filename

    • @@ -407,10 +408,10 @@

      consistency error (eg, bug) which caused bzip2 to panic.

    -
    +

    -2.4.OPTIONS

    -
    +2.4. OPTIONS

+
-c --stdout

Compress or decompress to standard output.

@@ -458,7 +459,7 @@

the same figure, at the expense of your compression ratio. In short, if your machine is low on memory (8 megabytes or less), use -s for everything. See - MEMORY MANAGEMENT below.

+ MEMORY MANAGEMENT below.

-q --quiet

Suppress non-essential warning messages. @@ -478,7 +479,7 @@

-9 (or -best)

Set the block size to 100 k, 200 k ... 900 k - when compressing. Has no effect when decompressing. See MEMORY MANAGEMENT below. The + when compressing. Has no effect when decompressing. See MEMORY MANAGEMENT below. The --fast and --best aliases are primarily for GNU gzip compatibility. @@ -502,9 +503,9 @@

renders these flags irrelevant.

-
+

-2.5.MEMORY MANAGEMENT

+2.5. MEMORY MANAGEMENT

bzip2 compresses large files in blocks. The block size affects both the compression ratio achieved, and the amount of memory needed for compression @@ -574,9 +575,9 @@

-8 6800k 3300k 2100k 828642 -9 7600k 3700k 2350k 828642

-
+

-2.6.RECOVERING DATA FROM DAMAGED FILES

+2.6. RECOVERING DATA FROM DAMAGED FILES

bzip2 compresses files in blocks, usually 900kbytes long. Each block is handled independently. If a media or transmission error causes a @@ -612,9 +613,9 @@

loss through media or transmission errors, you might consider compressing with a smaller block size.

-
+

-2.7.PERFORMANCE NOTES

+2.7. PERFORMANCE NOTES

The sorting phase of compression gathers together similar strings in the file. Because of this, files containing very long runs of repeated symbols, like "aabaabaabaab ..." (repeated @@ -638,14 +639,14 @@

bzip2 will perform best on machines with very large caches.

-
+

-2.8.CAVEATS

+2.8. CAVEATS

I/O error messages are not as helpful as they could be. bzip2 tries hard to detect I/O errors and exit cleanly, but the details of what the problem is sometimes seem rather misleading.

-

This manual page pertains to version 1.0.6 of +

This manual page pertains to version 1.0.8 of bzip2. Compressed data created by this version is entirely forwards and backwards compatible with the previous public releases, versions 0.1pl2, 0.9.0 and 0.9.5, 1.0.0, @@ -665,11 +666,11 @@

MaybeUInt64 set to be an unsigned 64-bit integer.

-
+

-2.9.AUTHOR

+2.9. AUTHOR

Julian Seward, -jseward@bzip.org

+jseward@acm.org

The ideas embodied in bzip2 are due to (at least) the following people: Michael Burrows and David Wheeler (for the @@ -690,14 +691,14 @@

advice and were generally helpful.

-
-

-3. +
+

+3.  Programming with libbzip2 -

+

Table of Contents

-
+
3.1. Top-level structure
3.1.1. Low-level summary
@@ -744,10 +745,10 @@

libbzip2.

For general background information, particularly about memory use and performance aspects, you'd be well advised to read -How to use bzip2 as well.

-
+How to use bzip2 as well.

+

-3.1.Top-level structure

+3.1. Top-level structure

libbzip2 is a flexible library for compressing and decompressing data in the bzip2 data format. Although @@ -765,9 +766,9 @@

To use any part of the library, you need to #include <bzlib.h> into your sources.

-
+

-3.1.1.Low-level summary

+3.1.1. Low-level summary

This interface provides services for compressing and decompressing data in memory. There's no provision for dealing with files, streams or any other I/O mechanisms, just straight @@ -800,9 +801,9 @@

consumer-pull style of activity, or producer-push, or a mixture of both.

-
+

-3.1.2.High-level summary

+3.1.2. High-level summary

This interface provides some handy wrappers around the low-level interface to facilitate reading and writing bzip2 format files @@ -839,9 +840,9 @@

file operations and file attributes, whilst not being much of an imposition on the programmer.

-
+

-3.1.3.Utility functions summary

+3.1.3. Utility functions summary

For very simple needs, BZ2_bzBuffToBuffCompress and BZ2_bzBuffToBuffDecompress are @@ -871,9 +872,9 @@

library to be built as a Windows DLL.

-
+

-3.2.Error handling

+3.2. Error handling

The library is designed to recover cleanly in all situations, including the worst-case situation of decompressing random data. I'm not 100% sure that it can always do this, so @@ -901,7 +902,7 @@

Rather, it is intended to convey the rough meaning of each return value. The first five actions are normal and not intended to denote an error situation.

-
+
BZ_OK

The requested action was completed successfully.

@@ -918,7 +919,7 @@

The following return values indicate an error of some kind.

-
+
BZ_CONFIG_ERROR

Indicates that the library has been improperly compiled on your platform -- a major configuration error. @@ -1008,12 +1009,12 @@

buffer provided.

-
+

-3.3.Low-level interface

-
+3.3. Low-level interface

+

-3.3.1.BZ2_bzCompressInit

+3.3.1. BZ2_bzCompressInit
typedef struct {
   char *next_in;
   unsigned int avail_in;
@@ -1137,9 +1138,9 @@ 

if BZ_OK is returned no specific action needed in case of error

-
+

-3.3.2.BZ2_bzCompress

+3.3.2. BZ2_bzCompress
int BZ2_bzCompress ( bz_stream *strm, int action );

Provides more input and/or output buffer space for the library. The caller maintains input and output buffers, and @@ -1329,9 +1330,9 @@

BZ_PARAM_ERROR
   if strm is NULL, or strm->s is NULL
-
+

-3.3.3.BZ2_bzCompressEnd

+3.3.3. BZ2_bzCompressEnd

int BZ2_bzCompressEnd ( bz_stream *strm );

Releases all memory associated with a compression stream.

@@ -1339,9 +1340,9 @@

BZ_PARAM_ERROR  if strm is NULL or strm->s is NULL
 BZ_OK           otherwise
-
+

-3.3.4.BZ2_bzDecompressInit

+3.3.4. BZ2_bzDecompressInit

int BZ2_bzDecompressInit ( bz_stream *strm, int verbosity, int small );

Prepares for decompression. As with BZ2_bzCompressInit, a @@ -1364,7 +1365,7 @@

library will use an alternative decompression algorithm which uses less memory but at the cost of decompressing more slowly (roughly speaking, half the speed, but the maximum memory -requirement drops to around 2300k). See How to use bzip2 +requirement drops to around 2300k). See How to use bzip2 for more information on memory management.

Note that the amount of memory needed to decompress a stream cannot be determined until the stream's header has been @@ -1386,9 +1387,9 @@

if BZ_OK was returned no specific action required in case of error -
+

-3.3.5.BZ2_bzDecompress

+3.3.5. BZ2_bzDecompress

int BZ2_bzDecompress ( bz_stream *strm );

Provides more input and/out output buffer space for the library. The caller maintains input and output buffers, and uses @@ -1461,9 +1462,9 @@

BZ2_bzDecompressEnd otherwise -
+

-3.3.6.BZ2_bzDecompressEnd

+3.3.6. BZ2_bzDecompressEnd

int BZ2_bzDecompressEnd ( bz_stream *strm );

Releases all memory associated with a decompression stream.

@@ -1476,13 +1477,13 @@

  None.
-
+

-3.4.High-level interface

+3.4. High-level interface

This interface provides functions for reading and writing bzip2 format files. First, some general points.

-
    +
    • All of the functions take an int* first argument, bzerror. After each call, @@ -1532,9 +1533,9 @@

      facility for user-defined memory allocators in the file I/O functions (could easily be added, though).

    -
    +

    -3.4.1.BZ2_bzReadOpen

    +3.4.1. BZ2_bzReadOpen
typedef void BZFILE;
 
 BZFILE *BZ2_bzReadOpen( int *bzerror, FILE *f, 
@@ -1594,9 +1595,9 @@ 

BZ2_bzClose otherwise

-
+

-3.4.2.BZ2_bzRead

+3.4.2. BZ2_bzRead
int BZ2_bzRead ( int *bzerror, BZFILE *b, void *buf, int len );

Reads up to len (uncompressed) bytes from the compressed file @@ -1668,9 +1669,9 @@

BZ2_bzReadClose otherwise -
+

-3.4.3.BZ2_bzReadGetUnused

+3.4.3. BZ2_bzReadGetUnused

void BZ2_bzReadGetUnused( int* bzerror, BZFILE *b, 
                           void** unused, int* nUnused );

Returns data which was read from the compressed file but @@ -1697,9 +1698,9 @@

Allowable next actions:

BZ2_bzReadClose
-
+

-3.4.4.BZ2_bzReadClose

+3.4.4. BZ2_bzReadClose

void BZ2_bzReadClose ( int *bzerror, BZFILE *b );

Releases all memory pertaining to the compressed file b. @@ -1717,9 +1718,9 @@

Allowable next actions:

none
-
+

-3.4.5.BZ2_bzWriteOpen

+3.4.5. BZ2_bzWriteOpen

BZFILE *BZ2_bzWriteOpen( int *bzerror, FILE *f, 
                          int blockSize100k, int verbosity,
                          int workFactor );
@@ -1763,9 +1764,9 @@

BZ2_bzWriteClose otherwise -
+

-3.4.6.BZ2_bzWrite

+3.4.6. BZ2_bzWrite

void BZ2_bzWrite ( int *bzerror, BZFILE *b, void *buf, int len );

Absorbs len bytes from the buffer buf, eventually to be @@ -1781,9 +1782,9 @@

BZ_OK otherwise -
+

-3.4.7.BZ2_bzWriteClose

+3.4.7. BZ2_bzWriteClose

void BZ2_bzWriteClose( int *bzerror, BZFILE* f,
                        int abandon,
                        unsigned int* nbytes_in,
@@ -1833,13 +1834,13 @@ 

BZ_OK otherwise

-
+

-3.4.8.Handling embedded compressed data streams

+3.4.8. Handling embedded compressed data streams

The high-level library facilitates use of bzip2 data streams which form some part of a surrounding, larger data stream.

-
    +
    • For writing, the library takes an open file handle, writes compressed data to it, fflushes it but does not @@ -1882,9 +1883,9 @@

      bite the bullet and get to grips with the low-level interface.

    -
    +

    -3.4.9.Standard file-reading/writing code

    +3.4.9. Standard file-reading/writing code

Here's how you'd write data to a compressed file:

FILE*   f;
 BZFILE* b;
@@ -1949,12 +1950,12 @@ 

}

-
+

-3.5.Utility functions

-
+3.5. Utility functions
+

-3.5.1.BZ2_bzBuffToBuffCompress

+3.5.1. BZ2_bzBuffToBuffCompress
int BZ2_bzBuffToBuffCompress( char*         dest,
                               unsigned int* destLen,
                               char*         source,
@@ -2005,9 +2006,9 @@ 

BZ_OK otherwise

-
+

-3.5.2.BZ2_bzBuffToBuffDecompress

+3.5.2. BZ2_bzBuffToBuffDecompress
int BZ2_bzBuffToBuffDecompress( char*         dest,
                                 unsigned int* destLen,
                                 char*         source,
@@ -2065,9 +2066,9 @@ 

otherwise

-
+

-3.6.zlib compatibility functions

+3.6. zlib compatibility functions

Yoshioka Tsuneo has contributed some functions to give better zlib compatibility. These functions are BZ2_bzopen, @@ -2108,12 +2109,12 @@

*errnum to its numerical value.

-
+

-3.7.Using the library in a stdio-free environment

-
+3.7. Using the library in a stdio-free environment

+

-3.7.1.Getting rid of stdio

+3.7.1. Getting rid of stdio

In a deeply embedded application, you might want to use just the memory-to-memory functions. You can do this conveniently by compiling the library with preprocessor symbol @@ -2131,9 +2132,9 @@

When compiled like this, all functions will ignore verbosity settings.

-
+

-3.7.2.Critical error handling

+3.7.2. Critical error handling

libbzip2 contains a number of internal assertion checks which should, needless to say, never be activated. Nevertheless, if an assertion should fail, @@ -2143,13 +2144,13 @@

message:

bzip2/libbzip2: internal error number N.

-

This is a bug in bzip2/libbzip2, 1.0.6 of 6 September 2010. -Please report it to me at: jseward@bzip.org. If this happened +

This is a bug in bzip2/libbzip2, 1.0.8 of 13 July 2019. +Please report it to: bzip2-devel@sourceware.org. If this happened when you were using some program which uses libbzip2 as a component, you should also report this bug to the author(s) of that program. Please make an effort to report this bug; timely and accurate bug reports eventually lead to higher -quality software. Thanks. Julian Seward, 6 September 2010. +quality software. Thanks.

where N is some error code @@ -2176,14 +2177,14 @@

recovered from.

-
+

-3.8.Making a Windows DLL

+3.8. Making a Windows DLL

Everything related to Windows has been contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp), so -you should send your queries to him (but perhaps Cc: me, -jseward@bzip.org).

+you should send your queries to him (but please Cc: +bzip2-devel@sourceware.org).

My vague understanding of what to do is: using Visual C++ 5.0, open the project file libbz2.dsp, and build. That's @@ -2218,12 +2219,12 @@

plausible.

-
-

-4.Miscellanea

+
+

+4. Miscellanea

These are just some random thoughts of mine. Your mileage may vary.

-
+

-4.1.Limitations of the compressed file format

+4.1. Limitations of the compressed file format

bzip2-1.0.X, 0.9.5 and 0.9.0 use exactly the same file @@ -2250,7 +2251,7 @@

shown complexities in the file format which slow down decompression and, in retrospect, are unnecessary. These are:

-
    +
    • The run-length encoder, which is the first of the compression transformations, is entirely irrelevant. The original purpose was to protect the sorting algorithm from the @@ -2298,7 +2299,7 @@

      doing so.

      Improvements which I was able to incorporate into 0.9.0, despite using the same file format, are:

      -
        +
        • Single array implementation of the inverse BWT. This significantly speeds up decompression, presumably because it reduces the number of cache misses.

        • @@ -2316,9 +2317,9 @@

          access into files. This will require some careful design of compressed file formats.

        -
        +

        -4.2.Portability issues

        +4.2. Portability issues

After some consideration, I have decided not to use GNU autoconf to configure 0.9.5 or 1.0.

@@ -2366,9 +2367,9 @@

file bzip2.c, before compiling. Otherwise the resulting binary won't work correctly.

-
+

-4.3.Reporting bugs

+4.3. Reporting bugs

I tried pretty hard to make sure bzip2 is bug free, both by design and by testing. Hopefully you'll never need to read this @@ -2379,7 +2380,7 @@

years of feedback of bzip2 users indicates that almost all these problems can be traced to either compiler bugs or hardware problems.

-
    +
    • Recompile the program with no optimisation, and see if it works. And/or try a different compiler. I heard all @@ -2447,9 +2448,9 @@

      time the problem happened. Without that, my ability to do anything more than speculate about the cause, is limited.

    -
    +

    -4.4.Did you get the right package?

    +4.4. Did you get the right package?

bzip2 is a resource hog. It soaks up large amounts of CPU cycles and memory. Also, it gives very large latencies. In the worst case, you can feed many @@ -2472,47 +2473,47 @@

compression/decompression library, at http://www.oberhumer.com/opensource.

-
+

-4.5.Further Reading

+4.5. Further Reading

bzip2 is not research work, in the sense that it doesn't present any new ideas. Rather, it's an engineering exercise based on existing ideas.

Four documents describe essentially all the ideas behind bzip2:

-

MichaelBurrowsandD.J.Wheeler:
-"Ablock-sortinglosslessdatacompressionalgorithm"
-10thMay1994.
-DigitalSRCResearchReport124.
-ftp://ftp.digital.com/pub/DEC/SRC/research-reports/SRC-124.ps.gz
-Ifyouhavetroublefindingit,trysearchingatthe
-NewZealandDigitalLibrary,http://www.nzdl.org.
+

Michael Burrows and D. J. Wheeler:
+  "A block-sorting lossless data compression algorithm"
+   10th May 1994. 
+   Digital SRC Research Report 124.
+   ftp://ftp.digital.com/pub/DEC/SRC/research-reports/SRC-124.ps.gz
+   If you have trouble finding it, try searching at the
+   New Zealand Digital Library, http://www.nzdl.org.

-DanielS.HirschbergandDebraA.LeLewer
-"EfficientDecodingofPrefixCodes"
-CommunicationsoftheACM,April1990,Vol33,Number4.
-Youmightbeabletogetanelectroniccopyofthis
-fromtheACMDigitalLibrary.
+Daniel S. Hirschberg and Debra A. LeLewer
+  "Efficient Decoding of Prefix Codes"
+   Communications of the ACM, April 1990, Vol 33, Number 4.
+   You might be able to get an electronic copy of this
+   from the ACM Digital Library.

-DavidJ.Wheeler
-Programbred3.candaccompanyingdocumentbred3.ps.
-Thiscontainstheideabehindthemulti-tableHuffmancodingscheme.
-ftp://ftp.cl.cam.ac.uk/users/djw3/
+David J. Wheeler
+   Program bred3.c and accompanying document bred3.ps.
+   This contains the idea behind the multi-table Huffman coding scheme.
+   ftp://ftp.cl.cam.ac.uk/users/djw3/

-JonL.BentleyandRobertSedgewick
-"FastAlgorithmsforSortingandSearchingStrings"
-AvailablefromSedgewick'swebpage,
-www.cs.princeton.edu/~rs
+Jon L. Bentley and Robert Sedgewick
+  "Fast Algorithms for Sorting and Searching Strings"
+   Available from Sedgewick's web page,
+   www.cs.princeton.edu/~rs

The following paper gives valuable additional insights into the algorithm, but is not immediately the basis of any code used in bzip2.

-

PeterFenwick:
-BlockSortingTextCompression
-Proceedingsofthe19thAustralasianComputerScienceConference,
-Melbourne,Australia.Jan31-Feb2,1996.
-ftp://ftp.cs.auckland.ac.nz/pub/peter-f/ACSC96paper.ps

+

Peter Fenwick:
+   Block Sorting Text Compression
+   Proceedings of the 19th Australasian Computer Science Conference,
+     Melbourne, Australia.  Jan 31 - Feb 2, 1996.
+   ftp://ftp.cs.auckland.ac.nz/pub/peter-f/ACSC96paper.ps

Kunihiko Sadakane's sorting algorithm, mentioned above, is available from:

http://naomi.is.s.u-tokyo.ac.jp/~sada/papers/Sada98b.ps.gz
@@ -2524,15 +2525,15 @@

Finally, the following papers document some investigations I made into the performance of sorting and decompression algorithms:

-

JulianSeward
-OnthePerformanceofBWTSortingAlgorithms
-ProceedingsoftheIEEEDataCompressionConference2000
-Snowbird,Utah.28-30March2000.
+

Julian Seward
+   On the Performance of BWT Sorting Algorithms
+   Proceedings of the IEEE Data Compression Conference 2000
+     Snowbird, Utah.  28-30 March 2000.

-JulianSeward
-Space-timeTradeoffsintheInverseB-WTransform
-ProceedingsoftheIEEEDataCompressionConference2001
-Snowbird,Utah.27-29March2001.
+Julian Seward
+   Space-time Tradeoffs in the Inverse B-W Transform
+   Proceedings of the IEEE Data Compression Conference 2001
+     Snowbird, Utah.  27-29 March 2001.

diff --git a/manual.pdf b/manual.pdf index f1c31a0ed2..ce62ac48f5 100644 Binary files a/manual.pdf and b/manual.pdf differ diff --git a/manual.ps b/manual.ps index cbc6f924df..7172dbdce2 100644 Binary files a/manual.ps and b/manual.ps differ diff --git a/manual.xml b/manual.xml index a7fbcb3375..ea9fca2e88 100644 --- a/manual.xml +++ b/manual.xml @@ -9,7 +9,7 @@ - bzip2 and libbzip2, version 1.0.6 + bzip2 and libbzip2, version &bz-version; A program and library for data compression &bz-lifespan; @@ -27,7 +27,7 @@ - + This program, bzip2, the associated library libbzip2, and @@ -139,7 +139,7 @@ else. bzip2, bunzip2 - a block-sorting file - compressor, v1.0.6 + compressor, v&bz-version; bzcat - decompresses files to stdout @@ -653,7 +653,7 @@ unsigned 64-bit integer. AUTHOR Julian Seward, -&bz-email; +&bz-author; The ideas embodied in bzip2 are due to (at least) the @@ -2487,12 +2487,12 @@ message:
bzip2/libbzip2: internal error number N. This is a bug in bzip2/libbzip2, &bz-version; of &bz-date;. -Please report it to me at: &bz-email;. If this happened +Please report it to: &bz-email;. If this happened when you were using some program which uses libbzip2 as a component, you should also report this bug to the author(s) of that program. Please make an effort to report this bug; timely and accurate bug reports eventually lead to higher -quality software. Thanks. Julian Seward, &bz-date;. +quality software. Thanks.
where N is some error code @@ -2537,7 +2537,7 @@ recovered from. Everything related to Windows has been contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp), so -you should send your queries to him (but perhaps Cc: me, +you should send your queries to him (but please Cc: &bz-email;). My vague understanding of what to do is: using Visual C++ diff --git a/mk251.c b/mk251.c index c9c36f6c48..6c5bbf9350 100644 --- a/mk251.c +++ b/mk251.c @@ -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 + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. diff --git a/randtable.c b/randtable.c index 6d62459906..bdc6d4a4cc 100644 --- a/randtable.c +++ b/randtable.c @@ -8,8 +8,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 + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. diff --git a/spewG.c b/spewG.c index 14a364938d..65d24c89cb 100644 --- a/spewG.c +++ b/spewG.c @@ -13,8 +13,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 + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. diff --git a/unzcrash.c b/unzcrash.c index 7041da51c9..c68f93c56c 100644 --- a/unzcrash.c +++ b/unzcrash.c @@ -17,8 +17,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 + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. diff --git a/words2 b/words2 index caddcf4226..203ee39c4c 100644 --- a/words2 +++ b/words2 @@ -1,5 +1,5 @@ Checking test results. If any of the four "cmp"s which follow report any differences, something is wrong. If you can't easily -figure out what, please let me know (jseward@bzip.org). +figure out what, please let me know (jseward@acm.org). diff --git a/xmlproc.sh b/xmlproc.sh old mode 100644 new mode 100755 index ca284ea9ed..16fe72b2d6 --- a/xmlproc.sh +++ b/xmlproc.sh @@ -5,8 +5,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 +# bzip2/libbzip2 version 1.0.8 of 13 July 2019 +# Copyright (C) 1996-2019 Julian Seward # # Please read the WARNING, DISCLAIMER and PATENTS sections in the # README file.