# zlib's 38-Line Safety Proof Is Wrong, but No Exploit Fits

Original title: Right Code, Wrong Comment: The Pointer Chase Inside Zlib

> Hacker News story 50556975 · language: en · submitted 2026-11-19
> Web version: https://zeli.app/story/50556975
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 3 · by [dataisland99](<https://news.ycombinator.com/user?id=dataisland99>) · 💬 0
[original](<https://www.dataisland.org/blog/zlib-overlay-chase.html>) · [HN discussion](<https://news.ycombinator.com/item?id=50556975>)

## Summary

Inside zlib's deflate, a stripped assertion guards against the output buffer overwriting unread symbols. The authors' 38-line proof that this can't happen is flawed: bounding average symbol cost doesn't prevent a mid-block collision, and a collision would trigger an out-of-bounds read in _dist_code[512]. Yet attempts to craft a crashing input all fail. The investigation builds Lean 4 proofs for zlib and zlib-ng, reducing pointer races to Huffman-tree inequalities and closing memLevel 1–2 algebraically.

## Key quote

> Bounding the average cost across all symbols says nothing about a prefix of symbols.

---

## Cite

- Page: https://zeli.app/story/50556975
- Date: 2026-11-19
- Source: dataisland.org (https://www.dataisland.org/blog/zlib-overlay-chase.html)
- Hacker News: https://news.ycombinator.com/item?id=50556975

## Other languages

- ja: https://zeli.app/ja/story/50556975 · markdown: https://zeli.app/ja/story/50556975.md
- ko: https://zeli.app/ko/story/50556975 · markdown: https://zeli.app/ko/story/50556975.md
- de: https://zeli.app/de/story/50556975 · markdown: https://zeli.app/de/story/50556975.md
- es: https://zeli.app/es/story/50556975 · markdown: https://zeli.app/es/story/50556975.md
- ru: https://zeli.app/ru/story/50556975 · markdown: https://zeli.app/ru/story/50556975.md
