]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
malloc: harden removal from unsorted list
authorFrancois Goichon <fgoichon@google.com>
Wed, 14 Mar 2018 20:25:57 +0000 (16:25 -0400)
committerDJ Delorie <dj@redhat.com>
Wed, 14 Mar 2018 20:25:57 +0000 (16:25 -0400)
* malloc/malloc.c (_int_malloc): Added check before removing from
unsorted list.

malloc/malloc.c

index e229181c5e252b1fa1e2bf800ab2ed03706c652e..96149549758dd424f5c08bed3b7ed1259d5d5664 100644 (file)
@@ -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);