bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: error in coffcode.h line 883


From: Nick Clifton
Subject: Re: error in coffcode.h line 883
Date: 03 May 2001 19:47:55 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Hi Reinhard,

> BFD: BFD internal error, aborting at
> /opt/mingw/gcc/source/binutils-2.11/bfd/coffcode.h line 883 in
> styp_to_sec_flags
> BFD: Please report this bug.

Thanks very much for this bug report.  I have now been able to track
down the problem and I am attaching a patch to fix it below.  I will
be applying this patch to the sources in the CVS repository in a few
moments.

The problem appears to have been a failure to correctly apply the
patch contributed by Todd Vierling:

  2001-02-07  Todd Vierling  <address@hidden>

        * libbfd-in.h (bfd_target_vector): Change extern array to pointer.
        * libbfd.h (bfd_target_vector): Likewise.
        * targets.c (bfd_target_vector): Rename to _bfd_target_vector and
        make static; create pointer reference named bfd_target_vector.
        (_bfd_target_vector_entries): Calculate this based on the array
        typed _bfd_target_vector.

The constant _bfd_target_vector_entries was being initialised based on
the size of bfd_target_vector (a pointer) instead of
_bfd_target_vector (an array).  Hence its value was always 1, and so
bfd_check_format_matches was only allocating enough room for one
ambiguously matching format.  In your particular case there are 4
ambiguous matches, so the code wrote over the end of the allocated
block of memory, causing all kinds of memory corruption!

Cheers
        Nick

2001-05-03  Nick Clifton  <address@hidden>

        * targets.c (_bfd_target_vector_entries): Compute value based on
        the size of the _bfd_target_vector and not bfd_target_vector.

Index: bfd/targets.c
===================================================================
RCS file: /cvs/src/src/bfd/targets.c,v
retrieving revision 1.41
diff -p -r1.41 targets.c
*** targets.c   2001/04/25 19:09:28     1.41
--- targets.c   2001/05/03 17:39:39
*************** const bfd_target *bfd_default_vector[] =
*** 1005,1011 ****
  /* When there is an ambiguous match, bfd_check_format_matches puts the
     names of the matching targets in an array.  This variable is the maximum
     number of entries that the array could possibly need.  */
! const size_t _bfd_target_vector_entries = sizeof (bfd_target_vector)/sizeof 
(*bfd_target_vector);
  
  /* This array maps configuration triplets onto BFD vectors.  */
  
--- 1005,1011 ----
  /* When there is an ambiguous match, bfd_check_format_matches puts the
     names of the matching targets in an array.  This variable is the maximum
     number of entries that the array could possibly need.  */
! const size_t _bfd_target_vector_entries = sizeof (_bfd_target_vector)/sizeof 
(*_bfd_target_vector);
  
  /* This array maps configuration triplets onto BFD vectors.  */
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]