When the archive member is mmapped in, but the index data is unaligned
we use memcpy to read in an aligned copy, unless ALLOWED_UNALIGNED is
true. Drop the ALLOWED_UNALIGNED condition and just always use memcpy
to read the unaligned index entries.
Also fix the alignment check. We need the file_data to be aligned
against w (the width of the entry, 4 or 8 bytes), not against n (the
number of entries).
* libelf/elf_getarsym.c (elf_getarsym): Drop the
ALLOWUNALIGNED condition and fix alignment check against
file_data.
Signed-off-by: Mark Wielaard <[email protected]>
---
libelf/elf_getarsym.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c
index 92af9645338a..d128aeba4686 100644
--- a/libelf/elf_getarsym.c
+++ b/libelf/elf_getarsym.c
@@ -251,8 +251,7 @@ elf_getarsym (Elf *elf, size_t *ptr)
else
{
file_data = (void *) (elf->map_address + off);
- if (!ALLOW_UNALIGNED
- && ((uintptr_t) file_data & -(uintptr_t) n) != 0)
+ if (((uintptr_t) file_data & (w - 1)) != 0)
{
temp_data = malloc (sz);
if (unlikely (temp_data == NULL))
--
2.56.1