Frommi / miniz_oxide

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

Infinite loop in deflate::compress_to_vec() on empty or one-byte slices #75

Closed Vlad-Shcherbina closed 4 years ago

Vlad-Shcherbina commented 4 years ago

To reproduce, run the following program (with miniz_oxide 0.3.6):

fn main() {
    miniz_oxide::deflate::compress_to_vec(&[], 6);
}

Expected result: it should terminate instantly. Actual result: it does not terminate.


Same for

fn main() {
    miniz_oxide::deflate::compress_to_vec(&[0], 6);
}
oyvindln commented 4 years ago

Ah somehow missed this issue being posted, will look into it.

Lokathor commented 4 years ago

Hey I just also hit this bug. Can we get a minor patch release to the crate so the fix is on crates.io?

oyvindln commented 4 years ago

Yeah, was hoping to get the fix for #74 as well, but haven't got confirmation on it yet.