diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | malloc/malloc.c | 3 |
2 files changed, 7 insertions, 0 deletions
@@ -1,3 +1,7 @@ +2018-08-16 Pochang Chen <johnchen902@gmail.com> + + * malloc/malloc.c (_int_malloc.c): Verify size of top chunk. + 2018-08-16 Siddhesh Poyarekar <siddhesh@sourceware.org> * benchtests/bench-strlen.c (do_test): Allocate buffers before diff --git a/malloc/malloc.c b/malloc/malloc.c index e247c77..9431108 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -4076,6 +4076,9 @@ _int_malloc (mstate av, size_t bytes) victim = av->top; size = chunksize (victim); + if (__glibc_unlikely (size > av->system_mem)) + malloc_printerr ("malloc(): corrupted top size"); + if ((unsigned long) (size) >= (unsigned long) (nb + MINSIZE)) { remainder_size = size - nb; |