public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix malloc double free check
@ 2004-09-10 19:49 Jakub Jelinek
  2004-09-10 19:58 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2004-09-10 19:49 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

Hi!

This patch fixes glibc build on ia64.

2004-09-10  Jakub Jelinek  <jakub@redhat.com>

	* malloc/malloc.c (_int_free): Only do arena boundary check for
	contiguous arenas.

--- libc/malloc/malloc.c	10 Sep 2004 10:30:43 -0000
+++ libc/malloc/malloc.c	10 Sep 2004 11:13:24 -0000
@@ -4229,8 +4229,9 @@ _int_free(mstate av, Void_t* mem)
       if (__builtin_expect (p == av->top, 0))
 	goto double_free;
       /* Or whether the next chunk is beyond the boundaries of the arena.  */
-      if (__builtin_expect ((char *) nextchunk >= ((char *) av->top
-						   + chunksize(av->top)), 0))
+      if (__builtin_expect (contiguous (av)
+			    && (char *) nextchunk
+			       >= ((char *) av->top + chunksize(av->top)), 0))
 	goto double_free;
       /* Or whether the block is actually not marked used.  */
       if (__builtin_expect (!prev_inuse(nextchunk), 0))

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix malloc double free check
  2004-09-10 19:49 [PATCH] Fix malloc double free check Jakub Jelinek
@ 2004-09-10 19:58 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2004-09-10 19:58 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Glibc hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Applied.

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFBQgdX2ijCOnn/RHQRAtzWAJ9j2F+Zjkj6DRsK51XkgM1QlTordQCfavYw
TYvsUIakrSQpa1+q7nCpcTg=
=SPq5
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-09-10 19:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-10 19:49 [PATCH] Fix malloc double free check Jakub Jelinek
2004-09-10 19:58 ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).