+2016-06-08 Florian Weimer <fweimer@redhat.com>
+
+ Emacs bug 23726.
+ * malloc/malloc.c (dumped_main_arena_start): Update comment.
+ (__libc_realloc): Correct size computation for dumped fake mmapped
+ chunks.
+
2016-06-07 Joseph Myers <joseph@codesourcery.com>
[BZ #20219]
/* These variables are used for undumping support. Chunked are marked
as using mmap, but we leave them alone if they fall into this
- range. */
+ range. NB: The chunk size for these chunks only includes the
+ initial size field (of SIZE_SZ bytes), there is no trailing size
+ field (unlike with regular mmapped chunks). */
static mchunkptr dumped_main_arena_start; /* Inclusive. */
static mchunkptr dumped_main_arena_end; /* Exclusive. */
if (newmem == 0)
return NULL;
/* Copy as many bytes as are available from the old chunk
- and fit into the new size. */
- if (bytes > oldsize - 2 * SIZE_SZ)
- bytes = oldsize - 2 * SIZE_SZ;
+ and fit into the new size. NB: The overhead for faked
+ mmapped chunks is only SIZE_SZ, not 2 * SIZE_SZ as for
+ regular mmapped chunks. */
+ if (bytes > oldsize - SIZE_SZ)
+ bytes = oldsize - SIZE_SZ;
memcpy (newmem, oldmem, bytes);
return newmem;
}