dovecot-1.2: lib-charset: Don't assert-crash when iconv() skips ...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 21 23:18:29 EEST 2010


details:   http://hg.dovecot.org/dovecot-1.2/rev/97b702abd132
changeset: 9586:97b702abd132
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 21 21:17:58 2010 +0100
description:
lib-charset: Don't assert-crash when iconv() skips lots of invalid input.

diffstat:

 src/lib-charset/charset-iconv.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r cdc66c6e0c6f -r 97b702abd132 src/lib-charset/charset-iconv.c
--- a/src/lib-charset/charset-iconv.c	Sat Jun 19 01:13:47 2010 +0300
+++ b/src/lib-charset/charset-iconv.c	Mon Jun 21 21:17:58 2010 +0100
@@ -131,7 +131,7 @@
 {
 	bool dtcase = (t->flags & CHARSET_FLAG_DECOMP_TITLECASE) != 0;
 	enum charset_result result;
-	size_t pos, used, size, prev_used = 0;
+	size_t pos, used, size, prev_pos = 0, prev_used = 0;
 	bool ret;
 
 	for (pos = 0;;) {
@@ -151,7 +151,8 @@
 			(void)buffer_append_space_unsafe(dest, size);
 			buffer_set_used_size(dest, used);
 		} else {
-			i_assert(dest->used != prev_used);
+			i_assert(dest->used != prev_used || pos != prev_pos);
+			prev_pos = pos;
 			prev_used = dest->used;
 		}
 	}


More information about the dovecot-cvs mailing list