Skip to content

Commit e5dd0d5

Browse files
committed
zstd: fix multi-frame stream decoding
1 parent b8a6c54 commit e5dd0d5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/compression-codecs/src/zstd/decoder.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ impl Decode for ZstdDecoder {
6161
.run_on_buffers(input.unwritten(), output.unwritten_mut())?;
6262
input.advance(status.bytes_read);
6363
output.advance(status.bytes_written);
64-
Ok(status.remaining == 0)
64+
65+
// See docs on remaining field
66+
let finished_frame = status.remaining == 0;
67+
// ... && "no more data"
68+
let done = finished_frame && status.bytes_read == 0;
69+
Ok(done)
6570
}
6671

6772
fn flush(

0 commit comments

Comments
 (0)