protect agains bogus debug data

Nathan Sidwell nathan@codesourcery.com
Fri Jan 26 12:50:00 GMT 2007


I had occasion to debug an executable with bogus dwarf information. 
Unfortunately it caused readelf to segfault, which was less than helpful.

Current binutils didn't segfault, but that was only by fortuitous accident of 
using 64bit offsets and therefore a < compare aborted a loop, rather than 
wandering off into the weeds.

This patch protects the dwarf info printer by checking that the comp unit's 
length and the abbrev offsets are sane.

I couldn't find a #define to format a dwarf_size_type, hence the icky cast to 
unsigned long in the warnings.  I guess I'd be happy if it didn't print out the 
length -- after all that can be discovered by examining the section headers.

tested on i686-pc-linux-gnu and powerpc-wrs-vxworks, ok?

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: all.diff
URL: <https://sourceware.org/pipermail/binutils/attachments/20070126/d5f13f0f/attachment.ksh>


More information about the Binutils mailing list