This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] malloc: harden removal from unsorted list
- From: Francois Goichon <fgoichon at google dot com>
- To: DJ Delorie <dj at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 26 Feb 2018 21:14:39 +0100
- Subject: Re: [PATCH] malloc: harden removal from unsorted list
- Authentication-results: sourceware.org; auth=none
- References: <xnlgfftx73.fsf@greed.delorie.com>
* malloc/malloc.c (_int_malloc): Added check before removing from
unsorted list.
---
malloc/malloc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 58f9acd4d1..fd1a263e9e 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3775,6 +3775,8 @@ _int_malloc (mstate av, size_t bytes)
}
/* remove from unsorted list */
+ if (__glibc_unlikely (bck->fd != victim))
+ malloc_printerr ("malloc(): corrupted unsorted chunks 3");
unsorted_chunks (av)->bk = bck;
bck->fd = unsorted_chunks (av);