malloc: Ensure that the consolidated fast chunk has a sane size.

This commit is contained in:
Istvan Kurucsai 2018-01-12 15:26:20 +01:00 committed by Florian Weimer
parent 1a51e46e4a
commit 249a5895f1
2 changed files with 10 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2018-01-12 Istvan Kurucsai <pistukem@gmail.com>
* malloc/malloc.c (malloc_consolidate): Add size check.
2018-01-12 Florian Weimer <fweimer@redhat.com>
* support/write_message.c (write_message): Preserve errno.

View File

@ -4431,6 +4431,12 @@ static void malloc_consolidate(mstate av)
p = atomic_exchange_acq (fb, NULL);
if (p != 0) {
do {
{
unsigned int idx = fastbin_index (chunksize (p));
if ((&fastbin (av, idx)) != fb)
malloc_printerr ("malloc_consolidate(): invalid chunk size");
}
check_inuse_chunk(av, p);
nextp = p->fd;