aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-02-27 14:49:10 +1030
committerAlan Modra <amodra@gmail.com>2023-02-28 10:37:12 +1030
commit3f316bf83bc59299e96e1395793e6493d3ab9581 (patch)
tree93819a88b45fef60023de55045205730bc27f438 /bfd
parentbb66431be17cf9f50c7712e852b72c2dfddd1ee0 (diff)
downloadbinutils-3f316bf83bc59299e96e1395793e6493d3ab9581.zip
binutils-3f316bf83bc59299e96e1395793e6493d3ab9581.tar.gz
binutils-3f316bf83bc59299e96e1395793e6493d3ab9581.tar.bz2
Another PE SEC_HAS_CONTENTS test
I'd skipped this one before, thinking "obfd, that's the linker output bfd so no need to test". Wrong, this is objcopy output. * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Test SEC_HAS_CONTENTS before reading section.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/peXXigen.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 43f3a83..d59a97f 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -3041,7 +3041,8 @@ _bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd)
return false;
}
- if (bfd_malloc_and_get_section (obfd, section, &data))
+ if ((section->flags & SEC_HAS_CONTENTS) != 0
+ && bfd_malloc_and_get_section (obfd, section, &data))
{
unsigned int i;
struct external_IMAGE_DEBUG_DIRECTORY *dd =