1*0ac9a9daSXin Li ------------------------------------------------------------------ 2*0ac9a9daSXin Li This file is part of bzip2/libbzip2, a program and library for 3*0ac9a9daSXin Li lossless, block-sorting data compression. 4*0ac9a9daSXin Li 5*0ac9a9daSXin Li bzip2/libbzip2 version 1.0.8 of 13 July 2019 6*0ac9a9daSXin Li Copyright (C) 1996-2019 Julian Seward <[email protected]> 7*0ac9a9daSXin Li 8*0ac9a9daSXin Li Please read the WARNING, DISCLAIMER and PATENTS sections in the 9*0ac9a9daSXin Li README file. 10*0ac9a9daSXin Li 11*0ac9a9daSXin Li This program is released under the terms of the license contained 12*0ac9a9daSXin Li in the file LICENSE. 13*0ac9a9daSXin Li ------------------------------------------------------------------ 14*0ac9a9daSXin Li 15*0ac9a9daSXin Li 16*0ac9a9daSXin Li0.9.0 17*0ac9a9daSXin Li~~~~~ 18*0ac9a9daSXin LiFirst version. 19*0ac9a9daSXin Li 20*0ac9a9daSXin Li 21*0ac9a9daSXin Li0.9.0a 22*0ac9a9daSXin Li~~~~~~ 23*0ac9a9daSXin LiRemoved 'ranlib' from Makefile, since most modern Unix-es 24*0ac9a9daSXin Lidon't need it, or even know about it. 25*0ac9a9daSXin Li 26*0ac9a9daSXin Li 27*0ac9a9daSXin Li0.9.0b 28*0ac9a9daSXin Li~~~~~~ 29*0ac9a9daSXin LiFixed a problem with error reporting in bzip2.c. This does not effect 30*0ac9a9daSXin Lithe library in any way. Problem is: versions 0.9.0 and 0.9.0a (of the 31*0ac9a9daSXin Liprogram proper) compress and decompress correctly, but give misleading 32*0ac9a9daSXin Lierror messages (internal panics) when an I/O error occurs, instead of 33*0ac9a9daSXin Lireporting the problem correctly. This shouldn't give any data loss 34*0ac9a9daSXin Li(as far as I can see), but is confusing. 35*0ac9a9daSXin Li 36*0ac9a9daSXin LiMade the inline declarations disappear for non-GCC compilers. 37*0ac9a9daSXin Li 38*0ac9a9daSXin Li 39*0ac9a9daSXin Li0.9.0c 40*0ac9a9daSXin Li~~~~~~ 41*0ac9a9daSXin LiFixed some problems in the library pertaining to some boundary cases. 42*0ac9a9daSXin LiThis makes the library behave more correctly in those situations. The 43*0ac9a9daSXin Lifixes apply only to features (calls and parameters) not used by 44*0ac9a9daSXin Libzip2.c, so the non-fixedness of them in previous versions has no 45*0ac9a9daSXin Lieffect on reliability of bzip2.c. 46*0ac9a9daSXin Li 47*0ac9a9daSXin LiIn bzlib.c: 48*0ac9a9daSXin Li * made zero-length BZ_FLUSH work correctly in bzCompress(). 49*0ac9a9daSXin Li * fixed bzWrite/bzRead to ignore zero-length requests. 50*0ac9a9daSXin Li * fixed bzread to correctly handle read requests after EOF. 51*0ac9a9daSXin Li * wrong parameter order in call to bzDecompressInit in 52*0ac9a9daSXin Li bzBuffToBuffDecompress. Fixed. 53*0ac9a9daSXin Li 54*0ac9a9daSXin LiIn compress.c: 55*0ac9a9daSXin Li * changed setting of nGroups in sendMTFValues() so as to 56*0ac9a9daSXin Li do a bit better on small files. This _does_ effect 57*0ac9a9daSXin Li bzip2.c. 58*0ac9a9daSXin Li 59*0ac9a9daSXin Li 60*0ac9a9daSXin Li0.9.5a 61*0ac9a9daSXin Li~~~~~~ 62*0ac9a9daSXin LiMajor change: add a fallback sorting algorithm (blocksort.c) 63*0ac9a9daSXin Lito give reasonable behaviour even for very repetitive inputs. 64*0ac9a9daSXin LiNuked --repetitive-best and --repetitive-fast since they are 65*0ac9a9daSXin Lino longer useful. 66*0ac9a9daSXin Li 67*0ac9a9daSXin LiMinor changes: mostly a whole bunch of small changes/ 68*0ac9a9daSXin Libugfixes in the driver (bzip2.c). Changes pertaining to the 69*0ac9a9daSXin Liuser interface are: 70*0ac9a9daSXin Li 71*0ac9a9daSXin Li allow decompression of symlink'd files to stdout 72*0ac9a9daSXin Li decompress/test files even without .bz2 extension 73*0ac9a9daSXin Li give more accurate error messages for I/O errors 74*0ac9a9daSXin Li when compressing/decompressing to stdout, don't catch control-C 75*0ac9a9daSXin Li read flags from BZIP2 and BZIP environment variables 76*0ac9a9daSXin Li decline to break hard links to a file unless forced with -f 77*0ac9a9daSXin Li allow -c flag even with no filenames 78*0ac9a9daSXin Li preserve file ownerships as far as possible 79*0ac9a9daSXin Li make -s -1 give the expected block size (100k) 80*0ac9a9daSXin Li add a flag -q --quiet to suppress nonessential warnings 81*0ac9a9daSXin Li stop decoding flags after --, so files beginning in - can be handled 82*0ac9a9daSXin Li resolved inconsistent naming: bzcat or bz2cat ? 83*0ac9a9daSXin Li bzip2 --help now returns 0 84*0ac9a9daSXin Li 85*0ac9a9daSXin LiProgramming-level changes are: 86*0ac9a9daSXin Li 87*0ac9a9daSXin Li fixed syntax error in GET_LL4 for Borland C++ 5.02 88*0ac9a9daSXin Li let bzBuffToBuffDecompress return BZ_DATA_ERROR{_MAGIC} 89*0ac9a9daSXin Li fix overshoot of mode-string end in bzopen_or_bzdopen 90*0ac9a9daSXin Li wrapped bzlib.h in #ifdef __cplusplus ... extern "C" { ... } 91*0ac9a9daSXin Li close file handles under all error conditions 92*0ac9a9daSXin Li added minor mods so it compiles with DJGPP out of the box 93*0ac9a9daSXin Li fixed Makefile so it doesn't give problems with BSD make 94*0ac9a9daSXin Li fix uninitialised memory reads in dlltest.c 95*0ac9a9daSXin Li 96*0ac9a9daSXin Li0.9.5b 97*0ac9a9daSXin Li~~~~~~ 98*0ac9a9daSXin LiOpen stdin/stdout in binary mode for DJGPP. 99*0ac9a9daSXin Li 100*0ac9a9daSXin Li0.9.5c 101*0ac9a9daSXin Li~~~~~~ 102*0ac9a9daSXin LiChanged BZ_N_OVERSHOOT to be ... + 2 instead of ... + 1. The + 1 103*0ac9a9daSXin Liversion could cause the sorted order to be wrong in some extremely 104*0ac9a9daSXin Liobscure cases. Also changed setting of quadrant in blocksort.c. 105*0ac9a9daSXin Li 106*0ac9a9daSXin Li0.9.5d 107*0ac9a9daSXin Li~~~~~~ 108*0ac9a9daSXin LiThe only functional change is to make bzlibVersion() in the library 109*0ac9a9daSXin Lireturn the correct string. This has no effect whatsoever on the 110*0ac9a9daSXin Lifunctioning of the bzip2 program or library. Added a couple of casts 111*0ac9a9daSXin Liso the library compiles without warnings at level 3 in MS Visual 112*0ac9a9daSXin LiStudio 6.0. Included a Y2K statement in the file Y2K_INFO. All other 113*0ac9a9daSXin Lichanges are minor documentation changes. 114*0ac9a9daSXin Li 115*0ac9a9daSXin Li1.0 116*0ac9a9daSXin Li~~~ 117*0ac9a9daSXin LiSeveral minor bugfixes and enhancements: 118*0ac9a9daSXin Li 119*0ac9a9daSXin Li* Large file support. The library uses 64-bit counters to 120*0ac9a9daSXin Li count the volume of data passing through it. bzip2.c 121*0ac9a9daSXin Li is now compiled with -D_FILE_OFFSET_BITS=64 to get large 122*0ac9a9daSXin Li file support from the C library. -v correctly prints out 123*0ac9a9daSXin Li file sizes greater than 4 gigabytes. All these changes have 124*0ac9a9daSXin Li been made without assuming a 64-bit platform or a C compiler 125*0ac9a9daSXin Li which supports 64-bit ints, so, except for the C library 126*0ac9a9daSXin Li aspect, they are fully portable. 127*0ac9a9daSXin Li 128*0ac9a9daSXin Li* Decompression robustness. The library/program should be 129*0ac9a9daSXin Li robust to any corruption of compressed data, detecting and 130*0ac9a9daSXin Li handling _all_ corruption, instead of merely relying on 131*0ac9a9daSXin Li the CRCs. What this means is that the program should 132*0ac9a9daSXin Li never crash, given corrupted data, and the library should 133*0ac9a9daSXin Li always return BZ_DATA_ERROR. 134*0ac9a9daSXin Li 135*0ac9a9daSXin Li* Fixed an obscure race-condition bug only ever observed on 136*0ac9a9daSXin Li Solaris, in which, if you were very unlucky and issued 137*0ac9a9daSXin Li control-C at exactly the wrong time, both input and output 138*0ac9a9daSXin Li files would be deleted. 139*0ac9a9daSXin Li 140*0ac9a9daSXin Li* Don't run out of file handles on test/decompression when 141*0ac9a9daSXin Li large numbers of files have invalid magic numbers. 142*0ac9a9daSXin Li 143*0ac9a9daSXin Li* Avoid library namespace pollution. Prefix all exported 144*0ac9a9daSXin Li symbols with BZ2_. 145*0ac9a9daSXin Li 146*0ac9a9daSXin Li* Minor sorting enhancements from my DCC2000 paper. 147*0ac9a9daSXin Li 148*0ac9a9daSXin Li* Advance the version number to 1.0, so as to counteract the 149*0ac9a9daSXin Li (false-in-this-case) impression some people have that programs 150*0ac9a9daSXin Li with version numbers less than 1.0 are in some way, experimental, 151*0ac9a9daSXin Li pre-release versions. 152*0ac9a9daSXin Li 153*0ac9a9daSXin Li* Create an initial Makefile-libbz2_so to build a shared library. 154*0ac9a9daSXin Li Yes, I know I should really use libtool et al ... 155*0ac9a9daSXin Li 156*0ac9a9daSXin Li* Make the program exit with 2 instead of 0 when decompression 157*0ac9a9daSXin Li fails due to a bad magic number (ie, an invalid bzip2 header). 158*0ac9a9daSXin Li Also exit with 1 (as the manual claims :-) whenever a diagnostic 159*0ac9a9daSXin Li message would have been printed AND the corresponding operation 160*0ac9a9daSXin Li is aborted, for example 161*0ac9a9daSXin Li bzip2: Output file xx already exists. 162*0ac9a9daSXin Li When a diagnostic message is printed but the operation is not 163*0ac9a9daSXin Li aborted, for example 164*0ac9a9daSXin Li bzip2: Can't guess original name for wurble -- using wurble.out 165*0ac9a9daSXin Li then the exit value 0 is returned, unless some other problem is 166*0ac9a9daSXin Li also detected. 167*0ac9a9daSXin Li 168*0ac9a9daSXin Li I think it corresponds more closely to what the manual claims now. 169*0ac9a9daSXin Li 170*0ac9a9daSXin Li 171*0ac9a9daSXin Li1.0.1 172*0ac9a9daSXin Li~~~~~ 173*0ac9a9daSXin Li* Modified dlltest.c so it uses the new BZ2_ naming scheme. 174*0ac9a9daSXin Li* Modified makefile-msc to fix minor build probs on Win2k. 175*0ac9a9daSXin Li* Updated README.COMPILATION.PROBLEMS. 176*0ac9a9daSXin Li 177*0ac9a9daSXin LiThere are no functionality changes or bug fixes relative to version 178*0ac9a9daSXin Li1.0.0. This is just a documentation update + a fix for minor Win32 179*0ac9a9daSXin Libuild problems. For almost everyone, upgrading from 1.0.0 to 1.0.1 is 180*0ac9a9daSXin Liutterly pointless. Don't bother. 181*0ac9a9daSXin Li 182*0ac9a9daSXin Li 183*0ac9a9daSXin Li1.0.2 184*0ac9a9daSXin Li~~~~~ 185*0ac9a9daSXin LiA bug fix release, addressing various minor issues which have appeared 186*0ac9a9daSXin Liin the 18 or so months since 1.0.1 was released. Most of the fixes 187*0ac9a9daSXin Liare to do with file-handling or documentation bugs. To the best of my 188*0ac9a9daSXin Liknowledge, there have been no data-loss-causing bugs reported in the 189*0ac9a9daSXin Licompression/decompression engine of 1.0.0 or 1.0.1. 190*0ac9a9daSXin Li 191*0ac9a9daSXin LiNote that this release does not improve the rather crude build system 192*0ac9a9daSXin Lifor Unix platforms. The general plan here is to autoconfiscate/ 193*0ac9a9daSXin Lilibtoolise 1.0.2 soon after release, and release the result as 1.1.0 194*0ac9a9daSXin Lior perhaps 1.2.0. That, however, is still just a plan at this point. 195*0ac9a9daSXin Li 196*0ac9a9daSXin LiHere are the changes in 1.0.2. Bug-reporters and/or patch-senders in 197*0ac9a9daSXin Liparentheses. 198*0ac9a9daSXin Li 199*0ac9a9daSXin Li* Fix an infinite segfault loop in 1.0.1 when a directory is 200*0ac9a9daSXin Li encountered in -f (force) mode. 201*0ac9a9daSXin Li (Trond Eivind Glomsrod, Nicholas Nethercote, Volker Schmidt) 202*0ac9a9daSXin Li 203*0ac9a9daSXin Li* Avoid double fclose() of output file on certain I/O error paths. 204*0ac9a9daSXin Li (Solar Designer) 205*0ac9a9daSXin Li 206*0ac9a9daSXin Li* Don't fail with internal error 1007 when fed a long stream (> 48MB) 207*0ac9a9daSXin Li of byte 251. Also print useful message suggesting that 1007s may be 208*0ac9a9daSXin Li caused by bad memory. 209*0ac9a9daSXin Li (noticed by Juan Pedro Vallejo, fixed by me) 210*0ac9a9daSXin Li 211*0ac9a9daSXin Li* Fix uninitialised variable silly bug in demo prog dlltest.c. 212*0ac9a9daSXin Li (Jorj Bauer) 213*0ac9a9daSXin Li 214*0ac9a9daSXin Li* Remove 512-MB limitation on recovered file size for bzip2recover 215*0ac9a9daSXin Li on selected platforms which support 64-bit ints. At the moment 216*0ac9a9daSXin Li all GCC supported platforms, and Win32. 217*0ac9a9daSXin Li (me, Alson van der Meulen) 218*0ac9a9daSXin Li 219*0ac9a9daSXin Li* Hard-code header byte values, to give correct operation on platforms 220*0ac9a9daSXin Li using EBCDIC as their native character set (IBM's OS/390). 221*0ac9a9daSXin Li (Leland Lucius) 222*0ac9a9daSXin Li 223*0ac9a9daSXin Li* Copy file access times correctly. 224*0ac9a9daSXin Li (Marty Leisner) 225*0ac9a9daSXin Li 226*0ac9a9daSXin Li* Add distclean and check targets to Makefile. 227*0ac9a9daSXin Li (Michael Carmack) 228*0ac9a9daSXin Li 229*0ac9a9daSXin Li* Parameterise use of ar and ranlib in Makefile. Also add $(LDFLAGS). 230*0ac9a9daSXin Li (Rich Ireland, Bo Thorsen) 231*0ac9a9daSXin Li 232*0ac9a9daSXin Li* Pass -p (create parent dirs as needed) to mkdir during make install. 233*0ac9a9daSXin Li (Jeremy Fusco) 234*0ac9a9daSXin Li 235*0ac9a9daSXin Li* Dereference symlinks when copying file permissions in -f mode. 236*0ac9a9daSXin Li (Volker Schmidt) 237*0ac9a9daSXin Li 238*0ac9a9daSXin Li* Majorly simplify implementation of uInt64_qrm10. 239*0ac9a9daSXin Li (Bo Lindbergh) 240*0ac9a9daSXin Li 241*0ac9a9daSXin Li* Check the input file still exists before deleting the output one, 242*0ac9a9daSXin Li when aborting in cleanUpAndFail(). 243*0ac9a9daSXin Li (Joerg Prante, Robert Linden, Matthias Krings) 244*0ac9a9daSXin Li 245*0ac9a9daSXin LiAlso a bunch of patches courtesy of Philippe Troin, the Debian maintainer 246*0ac9a9daSXin Liof bzip2: 247*0ac9a9daSXin Li 248*0ac9a9daSXin Li* Wrapper scripts (with manpages): bzdiff, bzgrep, bzmore. 249*0ac9a9daSXin Li 250*0ac9a9daSXin Li* Spelling changes and minor enhancements in bzip2.1. 251*0ac9a9daSXin Li 252*0ac9a9daSXin Li* Avoid race condition between creating the output file and setting its 253*0ac9a9daSXin Li interim permissions safely, by using fopen_output_safely(). 254*0ac9a9daSXin Li No changes to bzip2recover since there is no issue with file 255*0ac9a9daSXin Li permissions there. 256*0ac9a9daSXin Li 257*0ac9a9daSXin Li* do not print senseless report with -v when compressing an empty 258*0ac9a9daSXin Li file. 259*0ac9a9daSXin Li 260*0ac9a9daSXin Li* bzcat -f works on non-bzip2 files. 261*0ac9a9daSXin Li 262*0ac9a9daSXin Li* do not try to escape shell meta-characters on unix (the shell takes 263*0ac9a9daSXin Li care of these). 264*0ac9a9daSXin Li 265*0ac9a9daSXin Li* added --fast and --best aliases for -1 -9 for gzip compatibility. 266*0ac9a9daSXin Li 267*0ac9a9daSXin Li 268*0ac9a9daSXin Li1.0.3 (15 Feb 05) 269*0ac9a9daSXin Li~~~~~~~~~~~~~~~~~ 270*0ac9a9daSXin LiFixes some minor bugs since the last version, 1.0.2. 271*0ac9a9daSXin Li 272*0ac9a9daSXin Li* Further robustification against corrupted compressed data. 273*0ac9a9daSXin Li There are currently no known bitstreams which can cause the 274*0ac9a9daSXin Li decompressor to crash, loop or access memory which does not 275*0ac9a9daSXin Li belong to it. If you are using bzip2 or the library to 276*0ac9a9daSXin Li decompress bitstreams from untrusted sources, an upgrade 277*0ac9a9daSXin Li to 1.0.3 is recommended. This fixes CAN-2005-1260. 278*0ac9a9daSXin Li 279*0ac9a9daSXin Li* The documentation has been converted to XML, from which html 280*0ac9a9daSXin Li and pdf can be derived. 281*0ac9a9daSXin Li 282*0ac9a9daSXin Li* Various minor bugs in the documentation have been fixed. 283*0ac9a9daSXin Li 284*0ac9a9daSXin Li* Fixes for various compilation warnings with newer versions of 285*0ac9a9daSXin Li gcc, and on 64-bit platforms. 286*0ac9a9daSXin Li 287*0ac9a9daSXin Li* The BZ_NO_STDIO cpp symbol was not properly observed in 1.0.2. 288*0ac9a9daSXin Li This has been fixed. 289*0ac9a9daSXin Li 290*0ac9a9daSXin Li 291*0ac9a9daSXin Li1.0.4 (20 Dec 06) 292*0ac9a9daSXin Li~~~~~~~~~~~~~~~~~ 293*0ac9a9daSXin LiFixes some minor bugs since the last version, 1.0.3. 294*0ac9a9daSXin Li 295*0ac9a9daSXin Li* Fix file permissions race problem (CAN-2005-0953). 296*0ac9a9daSXin Li 297*0ac9a9daSXin Li* Avoid possible segfault in BZ2_bzclose. From Coverity's NetBSD 298*0ac9a9daSXin Li scan. 299*0ac9a9daSXin Li 300*0ac9a9daSXin Li* 'const'/prototype cleanups in the C code. 301*0ac9a9daSXin Li 302*0ac9a9daSXin Li* Change default install location to /usr/local, and handle multiple 303*0ac9a9daSXin Li 'make install's without error. 304*0ac9a9daSXin Li 305*0ac9a9daSXin Li* Sanitise file names more carefully in bzgrep. Fixes CAN-2005-0758 306*0ac9a9daSXin Li to the extent that applies to bzgrep. 307*0ac9a9daSXin Li 308*0ac9a9daSXin Li* Use 'mktemp' rather than 'tempfile' in bzdiff. 309*0ac9a9daSXin Li 310*0ac9a9daSXin Li* Tighten up a couple of assertions in blocksort.c following automated 311*0ac9a9daSXin Li analysis. 312*0ac9a9daSXin Li 313*0ac9a9daSXin Li* Fix minor doc/comment bugs. 314*0ac9a9daSXin Li 315*0ac9a9daSXin Li 316*0ac9a9daSXin Li1.0.5 (10 Dec 07) 317*0ac9a9daSXin Li~~~~~~~~~~~~~~~~~ 318*0ac9a9daSXin LiSecurity fix only. Fixes CERT-FI 20469 as it applies to bzip2. 319*0ac9a9daSXin Li 320*0ac9a9daSXin Li 321*0ac9a9daSXin Li1.0.6 (6 Sept 10) 322*0ac9a9daSXin Li~~~~~~~~~~~~~~~~~ 323*0ac9a9daSXin Li 324*0ac9a9daSXin Li* Security fix for CVE-2010-0405. This was reported by Mikolaj 325*0ac9a9daSXin Li Izdebski. 326*0ac9a9daSXin Li 327*0ac9a9daSXin Li* Make the documentation build on Ubuntu 10.04 328*0ac9a9daSXin Li 329*0ac9a9daSXin Li1.0.7 (27 Jun 19) 330*0ac9a9daSXin Li~~~~~~~~~~~~~~~~~ 331*0ac9a9daSXin Li 332*0ac9a9daSXin Li* Fix undefined behavior in the macros SET_BH, CLEAR_BH, & ISSET_BH 333*0ac9a9daSXin Li 334*0ac9a9daSXin Li* bzip2: Fix return value when combining --test,-t and -q. 335*0ac9a9daSXin Li 336*0ac9a9daSXin Li* bzip2recover: Fix buffer overflow for large argv[0] 337*0ac9a9daSXin Li 338*0ac9a9daSXin Li* bzip2recover: Fix use after free issue with outFile (CVE-2016-3189) 339*0ac9a9daSXin Li 340*0ac9a9daSXin Li* Make sure nSelectors is not out of range (CVE-2019-12900) 341*0ac9a9daSXin Li 342*0ac9a9daSXin Li1.0.8 (13 Jul 19) 343*0ac9a9daSXin Li~~~~~~~~~~~~~~~~~ 344*0ac9a9daSXin Li 345*0ac9a9daSXin Li* Accept as many selectors as the file format allows. 346*0ac9a9daSXin Li This relaxes the fix for CVE-2019-12900 from 1.0.7 347*0ac9a9daSXin Li so that bzip2 allows decompression of bz2 files that 348*0ac9a9daSXin Li use (too) many selectors again. 349*0ac9a9daSXin Li 350*0ac9a9daSXin Li* Fix handling of large (> 4GB) files on Windows. 351*0ac9a9daSXin Li 352*0ac9a9daSXin Li* Cleanup of bzdiff and bzgrep scripts so they don't use 353*0ac9a9daSXin Li any bash extensions and handle multiple archives correctly. 354*0ac9a9daSXin Li 355*0ac9a9daSXin Li* There is now a bz2-files testsuite at 356*0ac9a9daSXin Li https://sourceware.org/git/bzip2-tests.git 357