This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: MALLOC_CHECK_=1 produces false positives for arches defining MALLOC_ALIGNMENT > 8
- From: Wolfram Gloger <Wolfram dot Gloger at dent dot med dot uni-muenchen dot de>
- To: carlos at baldric dot uwo dot ca
- Cc: libc-alpha at sources dot redhat dot com
- Date: Mon, 27 Jan 2003 11:45:07 +0100 ("MET)
- Subject: Re: MALLOC_CHECK_=1 produces false positives for arches defining MALLOC_ALIGNMENT > 8
- References: <20030121053051.GD11795@systemhalted>
> I noticed that for arches defining MALLOC_ALIGNMENT > 8, which is a
> valid thing according to glibc/malloc/malloc.c, that the checks in
> hooks.c, particularly those in mem2chunk_check(), seemed a bit erroneous.
You are correct. Below is a patch. Thank you.
Regards,
Wolfram.
2003-01-27 Wolfram Gloger <wg@malloc.de>
* malloc/hooks.c (mem2chunk_check): Check alignment of mem
pointer, not of the computed chunk. Bug report from Carlos
O'Donell <carlos@baldric.uwo.ca>.
--- hooks.c 2002/07/11 13:45:01 1.5
+++ hooks.c 2003/01/27 10:36:11
@@ -179,8 +179,8 @@
INTERNAL_SIZE_T sz, c;
unsigned char magic;
+ if(!aligned_OK(mem)) return NULL;
p = mem2chunk(mem);
- if(!aligned_OK(p)) return NULL;
if( (char*)p>=mp_.sbrk_base &&
(char*)p<(mp_.sbrk_base+main_arena.system_mem) ) {
/* Must be a chunk in conventional heap memory. */