From d0f3a705cb587a6a753154bf19501aeb45b4b9a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kornel=20Lesin=CC=81ski?= Date: Sat, 4 Aug 2018 21:19:52 +0100 Subject: [PATCH] Handle insufficient buffer size as expected error --- src/deflate/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/deflate/mod.rs b/src/deflate/mod.rs index 263bb3f8..d14f8395 100644 --- a/src/deflate/mod.rs +++ b/src/deflate/mod.rs @@ -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)); },