This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PE bug: bad DataDirectory.


Hi Donn,

> Scenario: ldwrite calls _bfd_coff_final_link which calls
> _bfd_pei_final_link_postscript. _bfd_pei_final_link_postscript fills in
> the import table entries for the .idata section.
> 
> *Subsequently* main calls bfd_close calls coff_write_object_contents
> calls _bfd_pei_swap_aouthdr_out.  The memset in
> _bfd_pei_swap_aouthdr_out zeros out the work that
> _bfd_pei_final_link_postscript did.  Oops.

It appears that _bfd_pei_final_link_postscript only fills in entries 1
& 12 of the DataDictionary, and that apart from the memset
_bfd_pei_swap_aouthdr_out only initialises entries 0, 1, 2, 3 & 5.

I am not sure if ..aouthdr_out's initialisation of entry 1 is correct,
but assuming that it is, then it would seem that the memset should be
restricted to entries 4, 6, 7, 8, 9, 10, 11, 13, 14, 15 & 16.   Either
that or code to initialise entry 12 should be added to ...aouthdr_out().

What do you think ?

Cheers
        Nick



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]