This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] sysmalloc: Initialize previous size field of mmaped chunks
- From: fweimer at redhat dot com (Florian Weimer)
- To: libc-alpha at sourceware dot org
- Date: Fri, 28 Oct 2016 15:04:49 +0200
- Subject: [PATCH] sysmalloc: Initialize previous size field of mmaped chunks
- Authentication-results: sourceware.org; auth=none
With different encodings of the header, the previous zero initialization
may be insufficient and produce an invalid encoding.
2016-10-27 Florian Weimer <fweimer@redhat.com>
* malloc/malloc.c (sysmalloc): Initialize previous size field of
mmaped chunks.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 186e174..72d22bd 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -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);
}