malloc: harden removal from unsorted list

Message ID 8b1e34ca-7f35-c04e-0143-47608bdcf654@google.com
State Committed, archived
Headers

Commit Message

Francois Goichon Feb. 26, 2018, 8:14 p.m. UTC
  * malloc/malloc.c (_int_malloc): Added check before removing from
	unsorted list.
---
  malloc/malloc.c | 2 ++
  1 file changed, 2 insertions(+)
  

Comments

Francois Goichon March 12, 2018, 4:35 p.m. UTC | #1
Gentle ping - is anything required on my end here (e.g. pull request)?
  

Patch

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);