From: Aki Tuomi Date: Mon, 18 Sep 2023 10:38:50 +0000 (+0300) Subject: fs-compress: Limit minimum buffer size to 1k X-Git-Tag: 2.4.0~1933 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5a34d384d7adbb9b49be8adebb919e6274a34a8b;p=thirdparty%2Fdovecot%2Fcore.git fs-compress: Limit minimum buffer size to 1k Otherwise we might not get enough data to decompress the stream. --- diff --git a/src/plugins/fs-compress/fs-compress.c b/src/plugins/fs-compress/fs-compress.c index 4d82f075a6..83afc87e51 100644 --- a/src/plugins/fs-compress/fs-compress.c +++ b/src/plugins/fs-compress/fs-compress.c @@ -10,6 +10,8 @@ #include "compression.h" #include "fs-api-private.h" +#define FS_COMPRESS_ISTREAM_MIN_BUFFER_SIZE 1024 + struct compress_fs { struct fs fs; const struct compression_handler *compress_handler; @@ -173,7 +175,8 @@ fs_compress_read_stream(struct fs_file *_file, size_t max_buffer_size) return file->input; } - input = fs_read_stream(file->super_read, max_buffer_size); + input = fs_read_stream(file->super_read, + I_MAX(FS_COMPRESS_ISTREAM_MIN_BUFFER_SIZE, max_buffer_size)); if (file->fs->try_plain) flags |= ISTREAM_DECOMPRESS_FLAG_TRY; file->input = i_stream_create_decompress(input, flags);