diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2019-11-07 19:57:34 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2019-11-07 20:36:58 +0100 |
commit | 6c5f762596af9567afc4691beea212483fa7a07a (patch) | |
tree | 04f4eb32ed162cd13918c17e7e4fe0f9aaed540f | |
parent | 5b122e3a383c8e7603f1fc2322a6fe5298078a65 (diff) |
libinterimap: Don't panic at the end of the compressed stream.
Cf. Compress::Raw::Zlib's documentation. Z_STREAM_END denotes a
successful state.
-rw-r--r-- | Changelog | 2 | ||||
-rw-r--r-- | lib/Net/IMAP/InterIMAP.pm | 7 |
2 files changed, 6 insertions, 3 deletions
@@ -80,6 +80,8 @@ interimap (0.5) upstream; always mentioned ~/, which on POSIX-compliant systems expands to the value of the variable HOME. (Cf. Shell and Utilities volume of POSIX.1-2017, sec. 2.6.1.) + - libinterimap: don't panic() when inflate() reports the end of the + compression stream is reached. -- Guilhem Moulin <guilhem@fripost.org> Fri, 10 May 2019 00:58:14 +0200 diff --git a/lib/Net/IMAP/InterIMAP.pm b/lib/Net/IMAP/InterIMAP.pm index 9c95109..2d1f644 100644 --- a/lib/Net/IMAP/InterIMAP.pm +++ b/lib/Net/IMAP/InterIMAP.pm @@ -20,7 +20,7 @@ package Net::IMAP::InterIMAP v0.0.5; use warnings; use strict; -use Compress::Raw::Zlib qw/Z_OK Z_FULL_FLUSH Z_SYNC_FLUSH MAX_WBITS/; +use Compress::Raw::Zlib qw/Z_OK Z_STREAM_END Z_FULL_FLUSH Z_SYNC_FLUSH MAX_WBITS/; use Config::Tiny (); use Errno qw/EEXIST EINTR/; use Net::SSLeay 1.73 (); @@ -1723,8 +1723,9 @@ sub _getline($;$) { $self->{_OUTRAWCOUNT} += $n; if (defined (my $i = $self->{_Z_INFLATE})) { - $i->inflate($buf, $self->{_OUTBUF}) == Z_OK or - $self->panic("Inflation failed: ", $i->msg()); + my $r = $i->inflate($buf, $self->{_OUTBUF}); + $self->panic("Inflation failed: $r ", $i->msg()) + unless $r == Z_OK or $r == Z_STREAM_END; } else { $self->{_OUTBUF} = $buf; |