mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
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
This commit is contained in:
@@ -59,7 +59,7 @@ array_size_must_fail (size_t a, size_t b)
|
||||
pass, a, b);
|
||||
return false;
|
||||
}
|
||||
if (buf.data != buf.__space)
|
||||
if (buf.data != buf.__space.__c)
|
||||
{
|
||||
printf ("scratch_buffer_set_array_size did not free: %d %zu %zu\n",
|
||||
pass, a, b);
|
||||
|
Reference in New Issue
Block a user