Closed catenacyber closed 5 months ago
Hm, need to see what's done in C miniz and internally in zlib in this situation, and where the error is handled in those cases - that is it's called with the input having a complete block lacking the final flag but with the caller indicating there is no more data after that. Would have thought miniz would emulate what zlib did and as such we would have ported that behavior over and thus this would need to be fixed here but could be wrong.
Might take some time before I get around to this if no one else does.
Thanks. I do not trust myself to find the good solution (managed to find the above patch but do not trust it to solve the problem the right way zlib does)
I think the issue is that miniz_oxide erroneously ends up returning MZError::Data in this situation, rather than of MZError::Buf which is the equivalent error zlib and original miniz does (since this is technically an error after all), which flate2 will then ignore (while MZError::Data causes it to error out) and return the decoded data.
So, something like your suggested fix is probably the right approach yeah, will try to sort it when I have time.
Thanks. Would you know when will there be a patch release with this fix ?
I can do another one soon, was mainly holding off a bit in case @kornelski was working on any more PRs
Using code
And Cargo.toml
panicks
While Cargo.toml
succeeds in printing Hello
The data from this example comes from https://datatracker.ietf.org/doc/html/rfc7692#section-7.2.3.1
One fix may be in
inflate_loop
Instead of
add a check before like
Original report https://github.com/rust-lang/flate2-rs/issues/389