]> git.ipfire.org Git - thirdparty/glibc.git/commit
scratch_buffer: use union for internal buffer
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 18 Sep 2017 12:26:00 +0000 (09:26 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 26 Sep 2017 01:04:22 +0000 (18:04 -0700)
commit5f9f31ad129d97e6fc548954c9b97e27dd332600
treeb7f30d51192c046e0d23b6a04346d6549c9cb24f
parentccf970c7a77e86f4f5ef8ecc5e637114b1c0136a
scratch_buffer: use union for internal buffer

Problem reported by Florian Weimer [1] and solution suggested by
Andreas Schwab [2].  It also set the same buffer size independent
of architecture max_align_t size.

Checked on x86_64-linux-gnu and i686-linux-gnu.

* lib/malloc/scratch_buffer.h (struct scratch_buffer):
Use an union instead of a max_align_t array for __space,
so that __space is the same size on all platforms.
* malloc/scratch_buffer_grow_preserve.c
(__libc_scratch_buffer_grow_preserve): Likewise.

[1] https://sourceware.org/ml/libc-alpha/2017-09/msg00693.html
[2] https://sourceware.org/ml/libc-alpha/2017-09/msg00695.html
ChangeLog
include/scratch_buffer.h
malloc/scratch_buffer_grow_preserve.c
malloc/tst-scratch_buffer.c