Skip to content

Commit

Permalink
zlib 1.2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
madler committed Sep 10, 2011
1 parent 8e34b3a commit 85e7d7d
Show file tree
Hide file tree
Showing 21 changed files with 123 additions and 393 deletions.
11 changes: 9 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@

ChangeLog file for zlib
Changes in 1.2.0.3 (19 July 2003)
- Fix silly error in gzungetc() implementation [Vollant]
- Update contrib/minizip and contrib/vstudio [Vollant]
- Fix printf format in example.c
- Correct cdecl support in zconf.in.h [Anisimkov]
- Minor FAQ updates

Changes in 1.2.0.2 (13 July 2003)
- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons
- Attempt to avoid warnings in crc32.c for pointer-int conversion
Expand Down Expand Up @@ -31,8 +38,8 @@ Changes in 1.2.0.2 (13 July 2003)
- Report 2 only for level == 6
- Only deal with 64K limit when necessary at compile time [Truta]
- Allow TOO_FAR check to be turned off at compile time [Truta]
- Added gzclearerr() function [Souza]
- Added gzungetc() function
- Add gzclearerr() function [Souza]
- Add gzungetc() function

Changes in 1.2.0.1 (17 March 2003)
- Add Z_RLE strategy for run-length encoding [Truta]
Expand Down
52 changes: 33 additions & 19 deletions FAQ
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
3. Where can I get a Visual Basic interface to zlib?

See
* http://www.winimage.com/zLibDll/cmp-z-it.zip
* http://www.winimage.com/zLibDll/
* http://www.dogma.net/markn/articles/zlibtool/zlibtool.htm
* contrib/visual-basic.txt in the zlib distribution

Expand Down Expand Up @@ -147,11 +147,14 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
22. The license says that altered source versions must be "plainly marked". So
what exactly do I need to do to meet that requirement?

You need to append something the ZLIB_VERSION string in zlib.h. For
example, if the version of the base zlib you are altering is "1.2.3", then
you could change the string to "1.2.3-fred-mods-v3". You should not change
it to "1.2.4" or "1.2.3.1" since the zlib authors would like to reserve
those forms of the version for their own use.
You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In
particular, the final version number needs to be changed to "f", and an
identification string should be appended to ZLIB_VERSION. Version numbers
x.x.x.f are reserved for modifications to zlib by others than the zlib
maintainers. For example, if the version of the base zlib you are altering
is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and
ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also
update the version strings in deflate.c and inftrees.c.

For altered source distributions, you should also note the origin and
nature of the changes in zlib.h, as well as in ChangeLog and README, along
Expand All @@ -161,8 +164,8 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html

Note that distributing a compiled zlib library along with zlib.h and
zconf.h is also a source distribution, and so you should change
ZLIB_VERSION and note the origin and nature of the changes in zlib.h as you
would for a full source distribution.
ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes
in zlib.h as you would for a full source distribution.

23. Will zlib work on a big-endian or little-endian architecture, and can I
exchange compressed data between them?
Expand Down Expand Up @@ -212,12 +215,20 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
30. Can zlib work with greater than 4 GB of data?

Yes. inflate() and deflate() will process any amount of data correctly.
However the strm.total_in and strm_total_out counters may be limited to
4 GB. The application can easily set up its own counters updated after each
call of inflate() or deflate() to count beyond 4 GB. compress() and
uncompress() may be limited to 4 GB, since they operate in a single call
using unsigned long lengths. gzseek() and gztell() may be limited to 4 GB
depending on how zlib is compiled.
Each call of inflate() or deflate() is limited to input and output chunks
of the maximum value that can be stored in the compiler's "unsigned int"
type, but there is no limit to the number of chunks. Note however that the
strm.total_in and strm_total_out counters may be limited to 4 GB. These
counters are provided as a convenience and are not used internally by
inflate() or deflate(). The application can easily set up its own counters
updated after each call of inflate() or deflate() to count beyond 4 GB.
compress() and uncompress() may be limited to 4 GB, since they operate in a
single call. gzseek() and gztell() may be limited to 4 GB depending on how
zlib is compiled. See the zlibCompileFlags() function in zlib.h.

The word "may" appears several times above since there is a 4 GB limit
only if the compiler's "long" type is 32 bits. If the compiler's "long"
type is 64 bits, then the limit is 16 exabytes.

31. Does zlib have any security vulnerabilities?

Expand All @@ -228,7 +239,7 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
hand, if zlib is compiled to use snprintf() or vsnprintf(), which should
normally be the case, then there is no vulnerability. The ./configure
script will display warnings if an insecure variation of sprintf() will
be used by gzprintf(). Also the zlibCompileFlags() functions will return
be used by gzprintf(). Also the zlibCompileFlags() function will return
information on what variant of sprintf() is used by gzprintf().

If you don't have snprintf() or vsnprintf() and would like one, you can
Expand Down Expand Up @@ -262,9 +273,10 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html

35. How can I encrypt/decrypt zip files with zlib?

zlib doesn't support encryption. PKZIP encryption is very weak and can be
broken with freely available programs. To get strong encryption, use gpg
which already includes zlib compression.
zlib doesn't support encryption. The original PKZIP encryption is very weak
and can be broken with freely available programs. To get strong encryption,
use gpg ( http://www.gnupg.org/ ) which already includes zlib compression.
For PKZIP compatible "encryption", look at http://www.info-zip.org/

36. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings?

Expand All @@ -280,6 +292,8 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
for), using the "gzip" transfer encoding is probably more reliable due to
an unfortunate choice of name on the part of the HTTP 1.1 authors.

Bottom line: use the gzip format for HTTP 1.1 encoding.

37. Does zlib support the new "Deflate64" format introduced by PKWare?

No. PKWare has apparently decided to keep that format proprietary, since
Expand All @@ -290,4 +304,4 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
38. Can you please sign these lengthy legal documents and fax them back to us
so that we can use your software in our product?

No. Go away.
No. Go away. Shoo.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ LDFLAGS=libz.a
LDSHARED=$(CC)
CPP=$(CC) -E

VER=1.2.0.2
VER=1.2.0.3
LIBS=libz.a
SHAREDLIB=libz.so

Expand Down
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ LDFLAGS=libz.a
LDSHARED=$(CC)
CPP=$(CC) -E

VER=1.2.0.2
VER=1.2.0.3
LIBS=libz.a
SHAREDLIB=libz.so

Expand Down
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ZLIB DATA COMPRESSION LIBRARY

zlib 1.2.0.2 is a general purpose data compression library. All the code is
zlib 1.2.0.3 is a general purpose data compression library. All the code is
thread safe. The data format used by the zlib library is described by RFCs
(Request for Comments) 1950 to 1952 in the files
http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
Expand Down Expand Up @@ -34,7 +34,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
issue of Dr. Dobb's Journal; a copy of the article is available in
http://dogma.net/markn/articles/zlibtool/zlibtool.htm

The changes made in version 1.2.0.2 are documented in the file ChangeLog.
The changes made in version 1.2.0.3 are documented in the file ChangeLog.

Unsupported third party contributions are provided in directory "contrib".

Expand Down
31 changes: 23 additions & 8 deletions contrib/minizip/unzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,11 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
unz_s* s;
int err;


/* We remember the 'current' position in the file so that we can jump
* back there if we fail.
*/
unz_file_info cur_file_infoSaved;
unz_file_info_internal cur_file_info_internalSaved;
uLong num_fileSaved;
uLong pos_in_central_dirSaved;

Expand All @@ -843,25 +847,36 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
if (!s->current_file_ok)
return UNZ_END_OF_LIST_OF_FILE;

/* Save the current state */
num_fileSaved = s->num_file;
pos_in_central_dirSaved = s->pos_in_central_dir;
cur_file_infoSaved = s->cur_file_info;
cur_file_info_internalSaved = s->cur_file_info_internal;

err = unzGoToFirstFile(file);

while (err == UNZ_OK)
{
char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
unzGetCurrentFileInfo(file,NULL,
szCurrentFileName,sizeof(szCurrentFileName)-1,
NULL,0,NULL,0);
if (unzStringFileNameCompare(szCurrentFileName,
szFileName,iCaseSensitivity)==0)
return UNZ_OK;
err = unzGoToNextFile(file);
err = unzGetCurrentFileInfo(file,NULL,
szCurrentFileName,sizeof(szCurrentFileName)-1,
NULL,0,NULL,0);
if (err == UNZ_OK)
{
if (unzStringFileNameCompare(szCurrentFileName,
szFileName,iCaseSensitivity)==0)
return UNZ_OK;
err = unzGoToNextFile(file);
}
}

/* We failed, so restore the state of the 'current file' to where we
* were.
*/
s->num_file = num_fileSaved ;
s->pos_in_central_dir = pos_in_central_dirSaved ;
s->cur_file_info = cur_file_infoSaved;
s->cur_file_info_internal = cur_file_info_internalSaved;
return err;
}

Expand Down
Loading

0 comments on commit 85e7d7d

Please sign in to comment.