Skip to content

Commit

Permalink
fix(inflate): Don't return HasMoreOutput if we are waiting for more i…
Browse files Browse the repository at this point in the history
…nput to read adler32
  • Loading branch information
oyvindln committed Nov 28, 2021
1 parent 71b6891 commit 5869904
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion miniz_oxide/src/inflate/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1648,7 +1648,13 @@ pub fn decompress(
0
};

if status == TINFLStatus::NeedsMoreInput && out_buf.bytes_left() == 0 {
// Make sure HasMoreOutput overrides NeedsMoreInput if the output buffer is full.
// (Unless the missing input is the adler32 value in which case we don't need to write anything.)
// TODO: May want to see if we can do this in a better way.
if status == TINFLStatus::NeedsMoreInput
&& out_buf.bytes_left() == 0
&& state != State::ReadAdler32
{
status = TINFLStatus::HasMoreOutput
}

Expand Down

0 comments on commit 5869904

Please sign in to comment.