Fix a problem computing the size fields in the PE format header.
authorNick Clifton <nickc@redhat.com>
Thu, 5 Dec 2019 13:56:07 +0000 (13:56 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 5 Dec 2019 13:56:07 +0000 (13:56 +0000)
PR 25029
* peXXigen.c (_bfd_XXi_swap_aouthdr_out): Ignore empty sections
when computing the sizes stored in the headers.

bfd/ChangeLog
bfd/peXXigen.c

index 02c39fa416ef0f17ce6e345b97ddef25ed740912..f81477551903b0cf510041b8c354fde71bfb27b3 100644 (file)
@@ -1,3 +1,9 @@
+2019-12-05  Nick Clifton  <nickc@redhat.com>
+
+       PR 25029
+       * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Ignore empty sections
+       when computing the sizes stored in the headers.
+
 2019-12-03  Alan Modra  <amodra@gmail.com>
 
        PR 25230
index 1f55f927dc881d0c62155a2d54470f558f9ebe13..71d47ae660fbb922b1aa125b82997adc089f310b 100644 (file)
@@ -723,6 +723,9 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out)
       {
        int rounded = FA (sec->size);
 
+       if (rounded == 0)
+         continue;
+
        /* The first non-zero section filepos is the header size.
           Sections without contents will have a filepos of 0.  */
        if (hsize == 0)