Skip to content

Commit 367ec74

Browse files
authored
Merge pull request #423 from crazymerlyn/memerror
Return error instead of packing on Z_MEM_ERROR
2 parents 5d1ecf6 + 6084e47 commit 367ec74

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "flate2"
33
authors = ["Alex Crichton <[email protected]>", "Josh Triplett <[email protected]>"]
4-
version = "1.0.31"
4+
version = "1.0.32"
55
edition = "2018"
66
license = "MIT OR Apache-2.0"
77
readme = "README.md"

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)