dovecot-2.1: zlib: Avoid assert-crashing if parent ostream's wri...

dovecot at dovecot.org dovecot at dovecot.org
Sat Dec 10 07:57:43 EET 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/aefc17d5b99e
changeset: 13837:aefc17d5b99e
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Dec 10 07:57:16 2011 +0200
description:
zlib: Avoid assert-crashing if parent ostream's write had failed earlier.

diffstat:

 src/plugins/zlib/ostream-bzlib.c |  7 ++++++-
 src/plugins/zlib/ostream-zlib.c  |  7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r e28736bc8e09 -r aefc17d5b99e src/plugins/zlib/ostream-bzlib.c
--- a/src/plugins/zlib/ostream-bzlib.c	Sat Dec 10 07:28:22 2011 +0200
+++ b/src/plugins/zlib/ostream-bzlib.c	Sat Dec 10 07:57:16 2011 +0200
@@ -69,7 +69,12 @@
 	bool done = FALSE;
 	int ret;
 
-	i_assert(zs->avail_in == 0);
+	if (zs->avail_in != 0) {
+		i_assert(zstream->ostream.ostream.last_failed_errno != 0);
+		zstream->ostream.ostream.stream_errno =
+			zstream->ostream.ostream.last_failed_errno;
+		return -1;
+	}
 
 	if (zstream->flushed)
 		return 0;
diff -r e28736bc8e09 -r aefc17d5b99e src/plugins/zlib/ostream-zlib.c
--- a/src/plugins/zlib/ostream-zlib.c	Sat Dec 10 07:28:22 2011 +0200
+++ b/src/plugins/zlib/ostream-zlib.c	Sat Dec 10 07:57:16 2011 +0200
@@ -129,7 +129,12 @@
 	bool done = FALSE;
 	int ret;
 
-	i_assert(zs->avail_in == 0);
+	if (zs->avail_in != 0) {
+		i_assert(zstream->ostream.ostream.last_failed_errno != 0);
+		zstream->ostream.ostream.stream_errno =
+			zstream->ostream.ostream.last_failed_errno;
+		return -1;
+	}
 
 	if (zstream->flushed)
 		return 0;


More information about the dovecot-cvs mailing list