This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MALLOC_CHECK_=1 produces false positives for arches defining MALLOC_ALIGNMENT > 8


> 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. */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]