]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
unstrip: Don't try to write extra bogus versym data.
authorMark Wielaard <mark@klomp.org>
Sat, 19 Oct 2019 12:37:46 +0000 (14:37 +0200)
committerMark Wielaard <mark@klomp.org>
Sat, 26 Oct 2019 00:21:38 +0000 (02:21 +0200)
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 <mark@klomp.org>
src/ChangeLog
src/unstrip.c

index a20faff7753a5f67369ec1af6ede29fbd277ae1b..fe7ddbfd9f4bf00d6f08d87bd8f25f1a3657a440 100644 (file)
@@ -1,3 +1,8 @@
+2019-10-18  Mark Wielaard  <mark@klomp.org>
+
+       * unstrip.c (adjust_relocs): Set versym data d_size to the actual
+       size allocated.
+
 2019-10-20  Mark Wielaard  <mark@klomp.org>
 
        * unstrip.c (copy_elided_sections): Set and check max_off.
index 4e4366e5e3bdd48031f260b67e9807b8882f88ba..f4314d5dd80c6625fa7af22c1327f6817c0f97e7 100644 (file)
@@ -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);
       }