Handle insufficient buffer size as expected error

This commit is contained in:
Kornel Lesiński 2018-08-04 21:19:52 +01:00 committed by Kornel Lesiński
parent 4ec8cf8c7f
commit d0f3a705cb

View file

@ -81,7 +81,7 @@ pub fn cfzlib_deflate(
stream.avail_out = out.capacity() as uInt;
match deflate(&mut stream, Z_FINISH) {
Z_STREAM_END => {}
Z_OK => {
Z_OK | Z_BUF_ERROR => {
deflateEnd(&mut stream);
return Err(PngError::DeflatedDataTooLong(stream.total_out as usize));
},