On Thu, 2008-10-09 at 08:38 +0200, Andre Hübner wrote:
> #6  0x080c9d04 in i_stream_limit_read (stream=0x8118cc8) at 
> istream-limit.c:83
>         left = <value optimized out>
>         ret = -1
>         pos = 65
>         __PRETTY_FUNCTION__ = "i_stream_limit_read"

If you still have the core, could you do:

fr 6
p *stream

Does this happen often? Could you also try with the attached patch? It
should trigger the assert earlier.

diff -r 434a8a0edc0a src/lib/istream.c
--- a/src/lib/istream.c	Tue Oct 14 00:58:13 2008 +0300
+++ b/src/lib/istream.c	Tue Oct 14 14:32:33 2008 +0300
@@ -63,6 +63,7 @@
 {
 	struct istream_private *_stream = stream->real_stream;
 	ssize_t ret;
+	size_t orig_count;
 
 	if (unlikely(stream->closed))
 		return -1;
@@ -70,6 +71,7 @@
 	stream->eof = FALSE;
 	stream->stream_errno = 0;
 
+	orig_count = _stream->pos - _stream->skip;
 	ret = _stream->read(_stream);
 	if (ret == -1) {
 		if (stream->stream_errno != 0) {
@@ -79,6 +81,8 @@
 		} else {
 			i_assert(stream->eof);
 		}
+	} else if (ret > 0) {
+		i_assert(orig_count < _stream->pos - _stream->skip);
 	} else {
 		i_assert(ret != 0 || !stream->blocking);
 	}

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to