Skip to content

Commit

Permalink
Return error instead of packing on Z_MEM_ERROR
Browse files Browse the repository at this point in the history
  • Loading branch information
crazymerlyn committed Aug 19, 2024
1 parent 5d1ecf6 commit d0fdac5
Showing 1 changed file with 4 additions and 1 deletion.
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 d0fdac5

Please sign in to comment.