This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
ranlib may break archives at random
- To: binutils at sources dot redhat dot com
- Subject: ranlib may break archives at random
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 25 Dec 2000 18:57:48 -0200
- Organization: GCC Team, Red Hat
If you're unlucky enough, the garbage following map[symbol_count-1]
may pass the test and we'd get one (or more) unexpected
archive_member_file_ptr, that causes the archive to become invalid.
It has happened to me for the past few weeks, while building
libstdc++-v3 on some old version of FreeBSD, and it has just happened
to me again on a different port. Fixed thusly. Ok to install?
Index: bfd/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* archive.c (coff_write_armap): Don't write more than symbol_count
`archive_member_file_ptr's.
Index: bfd/archive.c
===================================================================
RCS file: /cvs/src/src/bfd/archive.c,v
retrieving revision 1.12
diff -u -p -r1.12 archive.c
--- bfd/archive.c 2000/11/20 19:05:12 1.12
+++ bfd/archive.c 2000/12/25 20:53:51
@@ -2198,7 +2198,7 @@ coff_write_armap (arch, elength, map, sy
/* For each symbol which is used defined in this object, write
out the object file's address in the archive. */
- while (((bfd *) (map[count]).pos) == current)
+ while (count < symbol_count && ((bfd *) (map[count]).pos) == current)
{
bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr);
count++;
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me