dovecot-2.2: lib: Fix MEM_ALIGN to cope with huge allocations
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jun 9 20:01:14 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/f9349a3c2604
changeset: 17446:f9349a3c2604
user: Phil Carmody <phil at dovecot.fi>
date: Mon Jun 09 22:59:59 2014 +0300
description:
lib: Fix MEM_ALIGN to cope with huge allocations
Attempting to allocate 2^32+1 bytes will look like it succeeds, as MEM_ALIGN
will set alloc_size = 8. The caller will then think it's got 4 gig to play
with.
e.g. t_malloc0 will wipe vast areas of memory before segfaulting, which might
include useful information we'd like in a corefile.
Signed-off-by: Phil Carmody <phil at dovecot.fi>
diffstat:
src/lib/macros.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diffs (12 lines):
diff -r 98195220a0f7 -r f9349a3c2604 src/lib/macros.h
--- a/src/lib/macros.h Mon Jun 09 22:53:16 2014 +0300
+++ b/src/lib/macros.h Mon Jun 09 22:59:59 2014 +0300
@@ -19,7 +19,7 @@
(sizeof(arr) / sizeof((arr)[0]))
#define MEM_ALIGN(size) \
- (((size) + MEM_ALIGN_SIZE-1) & ~((unsigned int) MEM_ALIGN_SIZE-1))
+ (((size) + MEM_ALIGN_SIZE-1) & ~((size_t) MEM_ALIGN_SIZE-1))
#define PTR_OFFSET(ptr, offset) \
((void *) (((unsigned char *) (ptr)) + (offset)))
More information about the dovecot-cvs
mailing list