From: Timo Sirainen Date: Mon, 16 Aug 2021 11:50:10 +0000 (+0300) Subject: lib-compression: istream-lz4 - Add asserts to make sure parent buffer isn't full X-Git-Tag: 2.3.17~201 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eea3b751dee019609e70d95b37118ec2abe4c6b1;p=thirdparty%2Fdovecot%2Fcore.git lib-compression: istream-lz4 - Add asserts to make sure parent buffer isn't full The parent buffer's max size would have to be tiny for these to happen. --- diff --git a/src/lib-compression/istream-lz4.c b/src/lib-compression/istream-lz4.c index 8638979a6e..ccfc924d4d 100644 --- a/src/lib-compression/istream-lz4.c +++ b/src/lib-compression/istream-lz4.c @@ -52,6 +52,7 @@ static int i_stream_lz4_read_header(struct lz4_istream *zstream) buffer_append(zstream->chunk_buf, data, size); i_stream_skip(zstream->istream.parent, size); if (ret < 0) { + i_assert(ret != -2); if (zstream->istream.istream.stream_errno == 0) { lz4_read_error(zstream, "missing header (not lz4 file?)"); zstream->istream.istream.stream_errno = EINVAL; @@ -99,6 +100,7 @@ static int i_stream_lz4_read_chunk_header(struct lz4_istream *zstream) buffer_append(zstream->chunk_buf, data, size); i_stream_skip(stream->parent, size); if (ret < 0) { + i_assert(ret != -2); stream->istream.stream_errno = stream->parent->stream_errno; if (stream->istream.stream_errno == 0) { stream->istream.eof = TRUE;