From: Mark Wielaard Date: Sat, 19 Oct 2019 12:37:46 +0000 (+0200) Subject: unstrip: Don't try to write extra bogus versym data. X-Git-Tag: elfutils-0.178~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da5a32a400da6a03a96f0aff10aff2d86bd9baad;p=thirdparty%2Felfutils.git unstrip: Don't try to write extra bogus versym data. If the sh_entsize of the symver section was bogus (bigger than necessary) then some bogus data would be written out (except that then fails because pwrite would probably fail). Fix that by ignoring the bogus sh_entsize and use the actual symver data size. https://sourceware.org/bugzilla/show_bug.cgi?id=25077 Signed-off-by: Mark Wielaard --- diff --git a/src/ChangeLog b/src/ChangeLog index a20faff77..fe7ddbfd9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2019-10-18 Mark Wielaard + + * unstrip.c (adjust_relocs): Set versym data d_size to the actual + size allocated. + 2019-10-20 Mark Wielaard * unstrip.c (copy_elided_sections): Set and check max_off. diff --git a/src/unstrip.c b/src/unstrip.c index 4e4366e5e..f4314d5dd 100644 --- a/src/unstrip.c +++ b/src/unstrip.c @@ -576,7 +576,7 @@ adjust_relocs (Elf_Scn *outscn, Elf_Scn *inscn, const GElf_Shdr *shdr, record_new_data (versym); data->d_buf = versym; - data->d_size = nent * shdr->sh_entsize; + data->d_size = nent * sizeof versym[0]; elf_flagdata (data, ELF_C_SET, ELF_F_DIRTY); update_sh_size (outscn, data); }