Frommi / miniz_oxide

Rust replacement for miniz
MIT License
168 stars 48 forks source link

Add support for limiting output size when decompressing to Vec #88

Closed Shnatsel closed 3 years ago

Shnatsel commented 3 years ago

I needed this in one of my projects and decided I'd better contribute upstream than hand-roll it. It's a common use case for handling untrusted data that may contain decompression bombs. Using the lower-level interface for this is quite complicated, as illustrated by this very function. People typically go through flate2 for this, but even then it's kinda awkward.

We're starting to see signs of combinatorial explosion here, so I'm open to making this into a builder pattern if you prefer.

oyvindln commented 3 years ago

Looks good for now.