fix 64 bit archives

Nathan Sidwell
Wed Jun 23 09:35:00 GMT 2010

This patch fixes a buffer overrun when generating the symbol map for a 64bit 
archive.  There are two loops, the outer one has a check for 'count < limit', 
but the inner one is responsible for incrementing count as it steps over a 
variable length run of symbols.  Unfortunately it fails to check for buffer end, 
and instead terminates when the abfd value changes.  Mostly this also changes 
after the end of the buffer, but sometimes it doesn't, and that leads to dumping 
out too many addresses and consequently ending up with a corrupt archive.

I took the opportunity to make the looping structure more obvious by using for 
loops rather than while loops.

built & tested on mips-linux.


Nathan Sidwell    ::   ::         CodeSourcery

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ar.patch
Type: text/x-patch
Size: 1462 bytes
Desc: not available
URL: <>

More information about the Binutils mailing list