From a23e9ba17f6ab8bef1f2cc02686e8567bdc728ca Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 5 Dec 2019 13:56:07 +0000 Subject: [PATCH] Fix a problem computing the size fields in the PE format header. PR 25029 * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Ignore empty sections when computing the sizes stored in the headers. --- bfd/ChangeLog | 6 ++++++ bfd/peXXigen.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 02c39fa416e..f8147755190 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2019-12-05 Nick Clifton + + 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 PR 25230 diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 1f55f927dc8..71d47ae660f 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -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) -- 2.30.2