Skip to content

Commit

Permalink
lib-compression: istream-zstd - Fix infinite loop when istream is non…
Browse files Browse the repository at this point in the history
…blocking
  • Loading branch information
sirainen committed Jun 9, 2020
1 parent 87f109d commit 0fb7f89
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib-compression/istream-zstd.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,16 @@ static ssize_t i_stream_zstd_read(struct istream_private *stream)
stream->istream.stream_errno = EPIPE;
return ret;
}
if (ret == 0)
return 0;
buffer_append(zstream->frame_buffer, data, size);
i_stream_skip(stream->parent, size);
zstream->input.src = zstream->frame_buffer->data;
zstream->input.size = zstream->frame_buffer->used;
zstream->input.pos = 0;
}

i_assert(zstream->input.size > 0);
i_assert(zstream->data_buffer->used == 0);
zstream->output.dst = buffer_append_space_unsafe(zstream->data_buffer,
ZSTD_DStreamOutSize());
Expand Down

0 comments on commit 0fb7f89

Please sign in to comment.