dovecot-2.2: lib: data-stack - fix realloc/lowwater bug

dovecot at dovecot.org dovecot at dovecot.org
Mon Jul 28 13:54:29 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/3856ea7037db
changeset: 17649:3856ea7037db
user:      Phil Carmody <phil at dovecot.fi>
date:      Mon Jul 28 16:45:33 2014 +0300
description:
lib: data-stack - fix realloc/lowwater bug
If DEBUG is enabled, then it can try to look past the low-water mark
as the low-water mark wasn't moved during successful reallocs. This
condition is detected, and causes a panic.

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/lib/data-stack.c |  2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diffs (12 lines):

diff -r beb56c7124ab -r 3856ea7037db src/lib/data-stack.c
--- a/src/lib/data-stack.c	Mon Jul 28 16:45:33 2014 +0300
+++ b/src/lib/data-stack.c	Mon Jul 28 16:45:33 2014 +0300
@@ -474,6 +474,8 @@
 		if (current_block->left >= alloc_growth) {
 			/* just shrink the available size */
 			current_block->left -= alloc_growth;
+			if (current_block->left < current_block->lowwater)
+				current_block->lowwater = current_block->left;
 			current_frame_block->last_alloc_size[frame_pos] =
 				new_alloc_size;
 			return TRUE;


More information about the dovecot-cvs mailing list