zlib replacement with optimizations for "next generation" systems.
Clone or download
sebpop and Dead2 fix #187: remove errors exposed by undefined behavior sanitizer
Move decrement in loop to avoid the following errors:
adler32.c:91:19: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long')
adler32.c:136:19: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long')
inflate.c:972:32: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int'

Fix the following bugs as recommended by Mika Lindqvist:
arch/x86/deflate_quick.c:233:22: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int'
arch/x86/fill_window_sse.c:52:28: runtime error: unsigned integer overflow: 1 - 8192 cannot be represented in type 'unsigned int'
Latest commit 9992d3b Aug 15, 2018
Permalink
Failed to load latest commit information.
arch fix #187: remove errors exposed by undefined behavior sanitizer Sep 20, 2018
doc zlib 1.2.5.1 Sep 11, 2011
test fix bug #184: clear out buf to avoid msan use-of-uninitialized-value Sep 17, 2018
tools CMakeLists.txt: better checking for Intel intrinsics. Feb 13, 2017
win32 [MSVC] Fix size_t/ssize_t when using ZLIB_COMPAT. (#161) Mar 22, 2018
.gitattributes Add a.exe to cleanup list. Jan 30, 2017
.gitignore Adapt code to support PREFIX macros and update build scripts Jan 31, 2018
.travis.yml Fix ZLIB_COMPAT=OFF and WITH_GZFILEOP=ON compilation failure. Sep 17, 2018
CMakeLists.txt replaced include_directories() with target_include_directories() Aug 9, 2018
ChangeLog.zlib zlib 1.2.11 Feb 13, 2017
FAQ.zlib zlib 1.2.11 Feb 13, 2017
INDEX zlib 1.2.11 Feb 13, 2017
INSTALL Update readme file, and add install instructions Feb 28, 2017
LICENSE.md Update readme and create LICENSE.md file Apr 10, 2015
Makefile.in Fix the problem about rule to make target "zconf.h" on Arm platforms Mar 14, 2018
README.md Update readme file, and add install instructions Feb 28, 2017
README.zlib zlib 1.2.11 Feb 13, 2017
adler32.c fix #187: remove errors exposed by undefined behavior sanitizer Sep 20, 2018
compress.c Move private defines from zconf.h and zconf-ng.h to zbuild.h Mar 22, 2018
configure Allow compiling with gzfileops from configure too Sep 17, 2018
crc32.c Move private defines from zconf.h and zconf-ng.h to zbuild.h Mar 22, 2018
crc32.h Style cleanup for adler/crc code May 25, 2015
deflate.c fix bugs #186 and #191, oss-fuzz/9831: use-of-uninitialized-value Sep 17, 2018
deflate.h Adapt code to support PREFIX macros and update build scripts Jan 31, 2018
deflate_fast.c Move private defines from zconf.h and zconf-ng.h to zbuild.h Mar 22, 2018
deflate_medium.c fix bug #192, oss-fuzz/9827 : MemorySanitizer:DEADLYSIGNAL Sep 17, 2018
deflate_p.h Adapt code to support PREFIX macros and update build scripts Jan 31, 2018
deflate_slow.c Move private defines from zconf.h and zconf-ng.h to zbuild.h Mar 22, 2018
functable.c Make functable thread-local. Sep 17, 2018
functable.h Make functable thread-local. Sep 17, 2018
gzclose.c Move private defines from zconf.h and zconf-ng.h to zbuild.h Mar 22, 2018
gzendian.h Fix build on ARM and gcc 4.x. Mar 14, 2018
gzguts.h Fix ZLIB_COMPAT=OFF and WITH_GZFILEOP=ON compilation failure. Sep 17, 2018
gzlib.c Move private defines from zconf.h and zconf-ng.h to zbuild.h Mar 22, 2018
gzread.c Fix ZLIB_COMPAT=OFF and WITH_GZFILEOP=ON compilation failure. Sep 17, 2018
gzwrite.c Fix ZLIB_COMPAT=OFF and WITH_GZFILEOP=ON compilation failure. Sep 17, 2018
infback.c Move private defines from zconf.h and zconf-ng.h to zbuild.h Mar 22, 2018
inffast.c Move private defines from zconf.h and zconf-ng.h to zbuild.h Mar 22, 2018
inffast.h Adapt code to support PREFIX macros and update build scripts Jan 31, 2018
inffixed.h Get inffixed.h and MAKEFIXED result to match. Oct 6, 2011
inflate.c fix #187: remove errors exposed by undefined behavior sanitizer Sep 20, 2018
inflate.h Adapt code to support PREFIX macros and update build scripts Jan 31, 2018
inftrees.c Move private defines from zconf.h and zconf-ng.h to zbuild.h Mar 22, 2018
inftrees.h Style cleanup for inflate code May 25, 2015
match.c Move private defines from zconf.h and zconf-ng.h to zbuild.h Mar 22, 2018
match.h Type cleanup. Dec 14, 2015
memcopy.h inflate: improve performance of memory copy operations Mar 29, 2017
treebuild.xml zlib 1.2.11 Feb 13, 2017
trees.c Move private defines from zconf.h and zconf-ng.h to zbuild.h Mar 22, 2018
trees.h local -> static Jan 30, 2017
uncompr.c Move private defines from zconf.h and zconf-ng.h to zbuild.h Mar 22, 2018
zbuild.h Make functable thread-local. Sep 17, 2018
zconf-ng.h.in Move private defines from zconf.h and zconf-ng.h to zbuild.h Mar 22, 2018
zconf.h.in Move private defines from zconf.h and zconf-ng.h to zbuild.h Mar 22, 2018
zlib-ng.h Fix ZLIB_COMPAT=OFF and WITH_GZFILEOP=ON compilation failure. Sep 17, 2018
zlib-ng.map Rename library based on zlib-compat setting Jan 31, 2018
zlib.3 zlib 1.2.11 Feb 13, 2017
zlib.3.pdf zlib 1.2.11 Feb 13, 2017
zlib.h [compat] Don't check for ZLIB_COMPAT Feb 16, 2018
zlib.map zlib 1.2.9 Feb 9, 2017
zlib.pc.cmakein Rename library based on zlib-compat setting Jan 31, 2018
zlib.pc.in Rename library based on zlib-compat setting Jan 31, 2018
zutil.c Move private defines from zconf.h and zconf-ng.h to zbuild.h Mar 22, 2018
zutil.h Adapt code to support PREFIX macros and update build scripts Jan 31, 2018

README.md

zlib-ng - zlib for the next generation systems

Maintained by Hans Kristian Rosbach aka Dead2 (zlib-ng àt circlestorm dót org)

Fork Motivation and History

The motivation for this fork was due to seeing several 3rd party contributions containing new optimizations not getting implemented into the official zlib repository.

Mark Adler has been maintaining zlib for a very long time, and he has done a great job and hopefully he will continue for a long time yet. The idea of zlib-ng is not to replace zlib, but to co-exist as a drop-in replacement with a lower threshold for code change.

zlib has a long history and is incredibly portable, even supporting lots of systems that predate the Internet. This is great, but it does complicate further development and maintainability. The zlib code has to make numerous workarounds for old compilers that do not understand ANSI-C or to accommodate systems with limitations such as operating in a 16-bit environment.

Many of these workarounds are only maintenance burdens, some of them are pretty huge code-wise. For example, the [v]s[n]printf workaround code has a whopping 8 different implementations just to cater to various old compilers. With this many workarounds cluttered throughout the code, new programmers with an idea/interest for zlib will need to take some time to figure out why all of these seemingly strange things are used, and how to work within those confines.

So I decided to make a fork, merge all the Intel optimizations, merge the Cloudflare optimizations that did not conflict, plus a couple of other smaller patches. Then I started cleaning out workarounds, various dead code, all contrib and example code as there is little point in having those in this fork for various reasons.

Zlib-ng is a work in progress, and we would be delighted to receive patches, preferably as pull requests on github. Just remember that any code you submit must be your own and it must be zlib licensed.

A lot of improvements have gone into zlib-ng since its start, and numerous people have contributed both small and big improvements, or valuable testing.

Please read LICENSE.md, it is very simple and very liberal.

Acknowledgments

Thanks to Raske Sider AS / servebolt.com for sponsoring my maintainership of zlib-ng.

Thanks go out to all the people and companies who have taken the time to contribute code reviews, testing and/or patches. Zlib-ng would not have been nearly as good without you.

The deflate format used by zlib was defined by Phil Katz. The deflate and zlib specifications were written by L. Peter Deutsch.

zlib was originally created by Jean-loup Gailly (compression) and Mark Adler (decompression).

Travis CI: build status