Hacker GitHub

← All repos

madler/zlib

View on GitHub ↗ ★ 7,186 C

A massively spiffy yet delicately unobtrusive compression library.

30 mentions on Hacker News by 27 people: 2 stories, 28 comments · first 2017-02-11 · latest 2026-07-16

Mentions per year 30 mentions · busiest year 2022 (13)
20082026
  1. …up; deflate has a very small, upper bound. But for short inputs this advantage is diminished. [1] https://github.com/madler/zlib/blob/develop/contrib/puff/puf... [2] https://blog.cloudflare.com/improving-compression-with-prese...
  2. Original zlib code: https://github.com/madler/zlib/blob/develop/contrib/puff/puf... The code of the article: https://github.com/ieviev/mini-gzip/blob/main/src/main.rs Top level declarations of the C code: #define MAXBITS 15 #define…
    comment by Rexxar · 2026-03-28 · in Gzip decompression in 250 lines of Rust
  3. …pre-computed table of 256× 32-bit constants so that one byte can processed at a time. For example: https://github.com/madler/zlib/blob/7cdaaa09095e9266dee21314...
    comment by nayuki · 2026-03-27 · in Gzip decompression in 250 lines of Rust
  4. he does mention https://github.com/trifectatechfoundation/zlib-rs not just https://github.com/madler/zlib , but it would be interesting to hear from those developers also
    comment by hybrid_study · 2026-03-27 · in Gzip decompression in 250 lines of Rust
  5. …Rust code, it appears to be a fairly straightforward port of puff.c (included in the zlib source): https://github.com/madler/zlib/blob/develop/contrib/puff/puf...
  6. …to literal("TOBEORNOT") copy(6,9) copy(9,15)? IIRC zlib won't consider matches at offset 0: https://github.com/madler/zlib/blob/5a82f71ed1dfc0bec044d970...
    comment by zmodem · 2025-09-18 · in Understanding Deflate
  7. It's true, using some rather non-obvious trickery: https://github.com/madler/zlib/blob/develop/examples/zran.c I also wrote a tool to make a randomly modifiable gzipped disk image: https://rwmj.wordpress.com/2022/12/01/creating-a-modifiable…
  8. Most if not all of bash. zlib changed it just a few months ago (1.3 release from August): https://github.com/madler/zlib/issues/633 I've also seen it in some FreeBSD code, but that was quite a few years ago and I don't know to what degree…
    comment by arp242 · 2023-12-23 · in Xmas.c (1988)
  9. …codes) that didn't match actual (malicious) input. Or, in zlib-the-library, there's other C code ( https://github.com/madler/zlib/blob/ac8f12c97d1afd9bafa9c710... ) that rejects unbalanced Huffman codes, but IIUC similar enforcement was…
    comment by nigeltao · 2023-09-22 · in The WebP 0day
  10. …spot, an automated test based on the domain knowledge is likely useless to catch this bug. [1] https://github.com/madler/zlib/blob/master/examples/enough.c
    comment by lifthrasiir · 2023-09-12 · in Chrome: Heap buffer overflow in WebP
  11. zlib: https://github.com/madler/zlib
    comment by jhasse · 2023-08-13 · in Exploring the Internals of Linux v0.01
  12. …(that you’d need for PNG) is not exactly complex[1], although slower than mainline zlib. [1] https://github.com/madler/zlib/tree/master/contrib/puff
    comment by mananaysiempre · 2022-12-18 · in Quite OK Image is now my favorite asset format
  13. These appear to be the relevant changes: 2022-07-30: https://github.com/madler/zlib/commit/eff308af425b67093bab25... 2022-08-08: https://github.com/madler/zlib/commit/1eb7682f845ac9e9bf9ae3... The second commit definitely fixed a null…
    comment by omoikane · 2022-10-15 · in Zlib Critical Vulnerability
  14. …preflate [2] leverages this to store the deflate stream reconstruction data without much bits. [1] https://github.com/madler/zlib/blob/21767c6/deflate.c#L134-L... [2] https://github.com/deus-libri/preflate/blob/master/preflate_...
    comment by lifthrasiir · 2022-09-10 · in Gzip and Brotli Compression Level Estimator
  15. It's still a full plate of old good C spaghetti https://github.com/madler/zlib/commit/eff308af425b67093bab25...
    comment by GoblinSlayer · 2022-08-30 · in What does it take to be a good programmer?
  16. The non-forked zlib hasn't been accepting optimisations: https://github.com/madler/zlib/issues/346 Hopefully changes will be merged from my obscure private fork into four other obscure private forks (zlib-chromium (…
  17. It was fixed in 2018, but no release was made at the time https://github.com/madler/zlib/commit/5c44459c3b28a9bd3283aa...
  18. …on some input when using Z_FIXED"). Yet, in what seems to be the canonical Zlib repository ( https://github.com/madler/zlib ), I was unable to find a corresponding commit. None of commits this year (7, so not too hard to review) seem to be…
    comment by mdb31 · 2022-03-28 · in Re: Zlib memory corruption on deflate
  19. Zlib's implementation, at least, requires more working RAM (~40 KB) than the Game Boy has (8 KB). https://github.com/madler/zlib/blob/master/zconf.h The memory requirements for inflate are (in bytes) 1 << windowBits that is, 32K for…
  20. …/en.wikipedia.org/wiki/GNU_coding_standards Zlib still uses K&R-1st-edition-era function definitions: https://github.com/madler/zlib/blob/cacf7f1d4e3d44d871b605da...
  21. …tries to create a home for many of the improvements, but is at the same time yet another fork. [0] https://github.com/madler/zlib/commits/develop [1] https://github.com/madler/zlib/pull/525 [2] https://github.com/jtkukunas/zlib [3]…
  22. …a massive speedup in my experience up to 20x for decompression and 220x (!) for compression [0]: https://github.com/madler/zlib/pull/410
  23. …also point interested readers towards zlib-ng [5] (without any endorsement or affiliation). [0]: https://github.com/madler/zlib/blob/master/inffast.c#L12 [1]: https://github.com/madler/zlib/blob/cacf7f1d4e3d44d871b605da... [2]:…
  24. …Bytef *source; uLong sourceLen; int level; { z_stream stream; int err; const uInt max = (uInt)-1; … https://github.com/madler/zlib/blob/master/compress.c
    comment by Rendello · 2021-09-13 · in Length-Limited Prefix Codes
  25. Does minizip, which in included in zlib, have the same bug. https://github.com/madler/zlib/tree/master/contrib/minizip
    comment by 1vuio0pswjnm7 · 2021-05-01 · in Redbean 0.4
  26. Does gzip actually use zlib? zlib's implementation ( https://github.com/madler/zlib/blob/v1.1.3/inflate.c ) looks different at first glance, gzip predates it by three years, and I believe gzip is also noticeably slower.
  27. …Few (or none?) of Chrome's fairly dramatic improvements to zlib have been upstreamed. https://github.com/madler/zlib/issues/346 Edit: Also, if browsers do adopt zstd, it's likely you'll end up with the same situation where they fork their…
  28. Mark Adler, the maintainer, has it here https://github.com/madler/zlib