Skip to content

Commit

Permalink
Merge pull request #423 from crazymerlyn/memerror
Browse files Browse the repository at this point in the history
Return error instead of packing on Z_MEM_ERROR
  • Loading branch information
Byron authored Aug 20, 2024
2 parents 5d1ecf6 + 6084e47 commit 367ec74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "flate2"
authors = ["Alex Crichton <[email protected]>", "Josh Triplett <[email protected]>"]
version = "1.0.31"
version = "1.0.32"
edition = "2018"
license = "MIT OR Apache-2.0"
readme = "README.md"
Expand Down
5 changes: 4 additions & 1 deletion src/ffi/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ impl InflateBackend for Inflate {
(*raw).avail_out = 0;

match rc {
MZ_DATA_ERROR | MZ_STREAM_ERROR => mem::decompress_failed(self.inner.msg()),
MZ_DATA_ERROR | MZ_STREAM_ERROR | MZ_MEM_ERROR => {
mem::decompress_failed(self.inner.msg())
}
MZ_OK => Ok(Status::Ok),
MZ_BUF_ERROR => Ok(Status::BufError),
MZ_STREAM_END => Ok(Status::StreamEnd),
Expand Down Expand Up @@ -431,6 +433,7 @@ mod c_backend {
pub use libz::Z_DEFLATED as MZ_DEFLATED;
pub use libz::Z_FINISH as MZ_FINISH;
pub use libz::Z_FULL_FLUSH as MZ_FULL_FLUSH;
pub use libz::Z_MEM_ERROR as MZ_MEM_ERROR;
pub use libz::Z_NEED_DICT as MZ_NEED_DICT;
pub use libz::Z_NO_FLUSH as MZ_NO_FLUSH;
pub use libz::Z_OK as MZ_OK;
Expand Down

0 comments on commit 367ec74

Please sign in to comment.