mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
gpg: fix --enarmor with zero length source file
* common/iobuf.c (filter_flush): Remove "src_len == 0" check. * g10/compress-bz2.c (do_compress): Exit early if flush not forced and input length is zero. * g10/compress.c (do_compress): Likewise. -- Remove "(src_len == 0)" check in filter_flush which was introduced to fix compress failure caused by zero length flush from iobuf_close. However this check broke enarmoring file with length of zero. Patch instead fixes zero length flush problem in compress filters. GnuPG-bug-id: T5828 Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
This commit is contained in:
parent
b96eb6f08d
commit
49c6e58394
@ -2090,14 +2090,6 @@ filter_flush (iobuf_t a)
|
|||||||
external_used = 0;
|
external_used = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src_len == 0)
|
|
||||||
{
|
|
||||||
if (DBG_IOBUF)
|
|
||||||
log_debug ("filter_flush, nothing to flush%s\n",
|
|
||||||
external_used ? " (external buffer)" : "");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
len = src_len;
|
len = src_len;
|
||||||
rc = a->filter (a->filter_ov, IOBUFCTRL_FLUSH, a->chain, src_buf, &len);
|
rc = a->filter (a->filter_ov, IOBUFCTRL_FLUSH, a->chain, src_buf, &len);
|
||||||
if (!rc && len != src_len)
|
if (!rc && len != src_len)
|
||||||
|
@ -66,6 +66,9 @@ do_compress(compress_filter_context_t *zfx, bz_stream *bzs, int flush, IOBUF a)
|
|||||||
int zrc;
|
int zrc;
|
||||||
unsigned n;
|
unsigned n;
|
||||||
|
|
||||||
|
if (flush == BZ_RUN && bzs->avail_in == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
bzs->next_out = zfx->outbuf;
|
bzs->next_out = zfx->outbuf;
|
||||||
|
@ -100,6 +100,9 @@ do_compress( compress_filter_context_t *zfx, z_stream *zs, int flush, IOBUF a )
|
|||||||
int zrc;
|
int zrc;
|
||||||
unsigned n;
|
unsigned n;
|
||||||
|
|
||||||
|
if (flush == Z_NO_FLUSH && zs->avail_in == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
zs->next_out = BYTEF_CAST (zfx->outbuf);
|
zs->next_out = BYTEF_CAST (zfx->outbuf);
|
||||||
zs->avail_out = zfx->outbufsize;
|
zs->avail_out = zfx->outbufsize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user