1 From 4245d63be73402df5917bbd099178ba56c136e13 Mon Sep 17 00:00:00 2001
2 From: Tomas Mraz <tmraz@fedoraproject.org>
3 Date: Thu, 12 Sep 2019 12:27:36 +0200
4 Subject: [PATCH] BIO_f_zlib: Properly handle BIO_CTRL_PENDING and
5 BIO_CTRL_WPENDING calls.
7 There can be data to write in output buffer and data to read that were
8 not yet read in the input stream.
12 crypto/comp/c_zlib.c | 25 +++++++++++++++++++++++++
13 1 file changed, 25 insertions(+)
15 diff --git a/crypto/comp/c_zlib.c b/crypto/comp/c_zlib.c
16 index 78219f202d8..3d2c142f004 100644
17 --- a/crypto/comp/c_zlib.c
18 +++ b/crypto/comp/c_zlib.c
19 @@ -546,6 +546,7 @@ static long bio_zlib_ctrl(BIO *b, int cmd, long num, void *ptr)
22 BIO *next = BIO_next(b);
27 @@ -598,6 +599,30 @@ static long bio_zlib_ctrl(BIO *b, int cmd, long num, void *ptr)
28 BIO_copy_next_retry(b);
31 + case BIO_CTRL_WPENDING:
32 + if (ctx->obuf == NULL)
41 + /* Unknown amount pending but we are not finished */
45 + ret = BIO_ctrl(next, cmd, num, ptr);
48 + case BIO_CTRL_PENDING:
50 + ret = zin->avail_in;
52 + ret = BIO_ctrl(next, cmd, num, ptr);
56 ret = BIO_ctrl(next, cmd, num, ptr);