aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffgen.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2001-11-02 16:29:15 +0000
committerNick Clifton <nickc@redhat.com>2001-11-02 16:29:15 +0000
commitb8819ab2f8f6c4a8ff4642d7df958486772e7b39 (patch)
treeb35db6d0ed0e611eb9556a4214d6fed7a4841314 /bfd/coffgen.c
parent21da9f89f2648f919c97277358cd4078b81047ae (diff)
downloadgdb-b8819ab2f8f6c4a8ff4642d7df958486772e7b39.zip
gdb-b8819ab2f8f6c4a8ff4642d7df958486772e7b39.tar.gz
gdb-b8819ab2f8f6c4a8ff4642d7df958486772e7b39.tar.bz2
Add comment
Diffstat (limited to 'bfd/coffgen.c')
-rw-r--r--bfd/coffgen.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 2ae435b..3ce9f78 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -280,6 +280,14 @@ coff_object_p (abfd)
bfd_coff_swap_filehdr_in (abfd, filehdr, &internal_f);
bfd_release (abfd, filehdr);
+ /* The XCOFF format has two sizes for the f_opthdr. SMALL_AOUTSZ
+ (less than aoutsz) used in object files and AOUTSZ (equal to
+ aoutsz) in executables. The bfd_coff_swap_aouthdr_in function
+ expects this header to be aoutsz bytes in length, so we use that
+ value in the call to bfd_alloc below. But we must be careful to
+ only read in f_opthdr bytes in the call to bfd_bread. We should
+ also attempt to catch corrupt or non-COFF binaries with a strange
+ value for f_opthdr. */
if (bfd_coff_bad_format_hook (abfd, &internal_f) == false
|| internal_f.f_opthdr > aoutsz)
{
@@ -294,7 +302,7 @@ coff_object_p (abfd)
opthdr = bfd_alloc (abfd, aoutsz);
if (opthdr == NULL)
- return 0;;
+ return 0;
if (bfd_bread (opthdr, (bfd_size_type) internal_f.f_opthdr, abfd)
!= internal_f.f_opthdr)
{