Before, this read and discarded one chunk of the compressed parent stream data,
causing data corruption. Fixed by checking whether the buffer is full first.
size_t size;
int ret;
+ /* if we already have max_buffer_size amount of data, fail here */
+ if (stream->pos - stream->skip >= i_stream_get_max_buffer_size(&stream->istream))
+ return -2;
+
if (!zstream->header_read) {
if ((ret = i_stream_lz4_read_header(zstream)) <= 0) {
stream->istream.eof = TRUE;
if (seeked)
break;
seeked = TRUE;
+ i_stream_seek(input, 1);
+ (void)i_stream_read(input);
i_stream_seek(input, 0);
}
i_stream_destroy(&input);