The zlib:gunzip/1 function makes it easy to decompress gzip-compressed data into memory. However, it defaults to imposing no upper limit on the size of the decompressed data and thus is suspectible to gzip bombs.
There’s zlib:safeInflate/2 which allows mitigating that risk, but it’s much more cumbersome to use. I have never seen it used in the wild, but I did see plenty of uses of zlib:gunzip/1 - most recently, in the req/lib/req/gzip.ex at main · wojtekmach/req · GitHub module of the very popular Req HTTP client in Elixir (which uses zlib:gunzip/1 to decompress HTTP payloads).
It would be nice if users were pushed harder towards the pit of success by having an API which makes it easy to deal with ZIP bombs.
Perhaps we could consider passing something like a MaxSize option (it defaults to infinity) to zlib:gunzip/2? Or maybe a separate zlib:safeGunzip/2 function?