sysmalloc: Initialize previous size field of mmaped chunks

With different encodings of the header, the previous zero initialization
may be insufficient and produce an invalid encoding.
This commit is contained in:
Florian Weimer 2016-10-27 19:45:19 +02:00
parent e9c4fe93b3
commit 681421f3ca
2 changed files with 6 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2016-10-27 Florian Weimer <fweimer@redhat.com>
* malloc/malloc.c (sysmalloc): Initialize previous size field of
mmaped chunks.
2016-10-28 Florian Weimer <fweimer@redhat.com>
* malloc/malloc.c (struct malloc_chunk): Rename prev_size, size

View File

@ -2306,6 +2306,7 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
else
{
p = (mchunkptr) mm;
set_prev_size (p, 0);
set_head (p, size | IS_MMAPPED);
}