SHA256
3
0
forked from pool/glibc
glibc/malloc-large-bin-corruption-check.patch

20 lines
969 B
Diff
Raw Normal View History

Index: glibc-2.29/malloc/malloc.c
===================================================================
--- glibc-2.29.orig/malloc/malloc.c
+++ glibc-2.29/malloc/malloc.c
@@ -3876,10 +3876,14 @@ _int_malloc (mstate av, size_t bytes)
{
victim->fd_nextsize = fwd;
victim->bk_nextsize = fwd->bk_nextsize;
+ if (__glibc_unlikely (fwd->bk_nextsize->fd_nextsize != fwd))
+ malloc_printerr ("malloc(): largebin double linked list corrupted (nextsize)");
fwd->bk_nextsize = victim;
victim->bk_nextsize->fd_nextsize = victim;
}
bck = fwd->bk;
+ if (bck->fd != fwd)
+ malloc_printerr ("malloc(): largebin double linked list corrupted (bk)");
}
}
else