From fa58820c15b6e95c92e104850b5c3b46ee44a684 Mon Sep 17 00:00:00 2001 From: nickc Date: Fri, 2 Nov 2001 16:29:15 +0000 Subject: [PATCH] Add comment --- bfd/ChangeLog | 4 ++++ bfd/coffgen.c | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ce54d18fd6..c5896e1d97 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2001-11-02 Nick Clifton + + * coffgen.c (coff_object_p): Add comment to H.J.'s recent patch. + 2001-11-02 John David Anglin * som.c (setup_sections): Initialize subspace_sections. diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 2ae435b2dc..3ce9f7849d 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) { -- 2.11.0