PE bug: bad DataDirectory.

Nick Clifton nickc@redhat.com
Fri Aug 16 09:13:00 GMT 2002


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




More information about the Binutils mailing list