stop bogus dwarf killing objdump
Nick Clifton
nickc@redhat.com
Sat Feb 16 09:29:00 GMT 2008
Hi Nathan,
> I had the misfortune to have an executable with bogus dwarf information.
Just to check - how did readelf cope with this corrupt binary ?
> ! while (stash->info_ptr < stash->info_ptr_end)
> {
> bfd_vma length;
> unsigned int offset_size = addr_size;
> --- 3023,3029 ----
> BFD_ASSERT (addr_size == 4 || addr_size == 8);
>
> /* Read each remaining comp. units checking each as they are read. */
> ! while (stash->info_ptr != stash->info_ptr_end)
> {
> bfd_vma length;
> unsigned int offset_size = addr_size;
I do not like this change. A corrupt value in the length field of a
comp unit could cause stash->info_ptr to be set beyond
stash->info_ptr_end which could lead to all kinds of problems. Besides
it is not needed because...
> each = parse_comp_unit (stash, length, info_ptr_unit,
> offset_size);
> + if (!each)
> + {
> + /* The dwarf information is damaged, don't trust it any
> + more. */
> + stash->info_ptr = stash->info_ptr_end;
> + break;
> + }
The break here will exit the while loop without ever testing
stash->info_ptr (and so setting it to stash->info_ptr_end is redundant).
Please could you modify your patch to just check the return value from
parse_comp_unit and break the loop if it is NULL ?
Cheers
Nick
More information about the Binutils
mailing list