Skip to content

Commit d0fdac5

Browse files
committed
Return error instead of packing on Z_MEM_ERROR
1 parent 5d1ecf6 commit d0fdac5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ffi/c.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,9 @@ impl InflateBackend for Inflate {
263263
(*raw).avail_out = 0;
264264

265265
match rc {
266-
MZ_DATA_ERROR | MZ_STREAM_ERROR => mem::decompress_failed(self.inner.msg()),
266+
MZ_DATA_ERROR | MZ_STREAM_ERROR | MZ_MEM_ERROR => {
267+
mem::decompress_failed(self.inner.msg())
268+
}
267269
MZ_OK => Ok(Status::Ok),
268270
MZ_BUF_ERROR => Ok(Status::BufError),
269271
MZ_STREAM_END => Ok(Status::StreamEnd),
@@ -431,6 +433,7 @@ mod c_backend {
431433
pub use libz::Z_DEFLATED as MZ_DEFLATED;
432434
pub use libz::Z_FINISH as MZ_FINISH;
433435
pub use libz::Z_FULL_FLUSH as MZ_FULL_FLUSH;
436+
pub use libz::Z_MEM_ERROR as MZ_MEM_ERROR;
434437
pub use libz::Z_NEED_DICT as MZ_NEED_DICT;
435438
pub use libz::Z_NO_FLUSH as MZ_NO_FLUSH;
436439
pub use libz::Z_OK as MZ_OK;

0 commit comments

Comments
 (0)