MALLOC_CHECK_=1 produces false positives for arches defining MALLOC_ALIGNMENT > 8
Wolfram Gloger
Wolfram.Gloger@dent.med.uni-muenchen.de
Mon Jan 27 18:37:00 GMT 2003
> 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. */
More information about the Libc-alpha
mailing list