Memory exhaustion via crafted zip file · Issue #156002 · python/cpython
Repository navigation
Memory exhaustion via crafted zip file #156002
New issue
New issue
Closed
Closed
Memory exhaustion via crafted zip file #156002 Labels
3.10 (EOL)
3.11
3.12
3.13
3.14
3.15
3.16
stdlib
type-security
Description
@encukou's profile encukou opened on Aug 18, 2026As reported by @tonghuaroot :
zipfile.ZipExtFile._read1() bounds the output of each decompress() call for DEFLATE members (it passes a max_length to zlib), but for bzip2 / LZMA / Zstandard members it called self._decompressor.decompress(data) with no bound . A whole compressed chunk was therefore expanded into a single allocation before the data = data[:self._left] clip ran.
Linked PRs
- gh-156002: Bound zipfile decompression for bzip2/LZMA/Zstandard #156003
- [3.15] gh-156002: Bound zipfile decompression for bzip2/LZMA/Zstandard (GH-156003) #156362
- [3.14] gh-156002: Bound zipfile decompression for bzip2/LZMA/Zstandard (GH-156003) (GH-156362) #156737
- [3.13] gh-156002: Bound zipfile decompression for bzip2/LZMA (GH-156003) (GH-156362) #156738
- [3.12] gh-156002: Bound zipfile decompression for bzip2/LZMA/Zstandard (GH-156003) (GH-156362) #156739
- [3.11] gh-156002: Bound zipfile decompression for bzip2/LZMA/Zstandard (GH-156003) (GH-156362) #156740
- [3.10] gh-156002: Bound zipfile decompression for bzip2/LZMA/Zstandard (GH-156003) (GH-156362) #156741
- gh-156002: Keep reading through third-party zipfile decompressors #157180
- [3.15] gh-156002: Keep reading through monkey-patched zipfile decompressors (GH-157180) #157268
- [3.14] gh-156002: Keep reading through monkey-patched zipfile decompressors (GH-157180) (GH-157268) #157557
Metadata
Metadata
Assignees
No one assignedLabels
3.10 (EOL)
3.11
3.12
3.13
3.14
3.15
3.16
stdlib
type-security
Projects
- Zipfile issues 📦 Status Done