[PATCH, COMMIT]: Avoid seg-fault when merging entries
Nick Clifton
nickc@redhat.com
Fri Aug 20 14:44:00 GMT 2010
Hi Guys,
I am checking in the patch below as a fix for a bug reported on the
Fedora bugzilla system:
https://bugzilla.redhat.com/show_bug.cgi?id=623687
Cheers
Nick
bfd/ChangeLog
2010-08-20 Nick Clifton <nickc@redhat.com>
* merge.c (sec_merge_emit): Do not zero pad sections that do not
have an alignment.
Index: bfd/merge.c
===================================================================
RCS file: /cvs/src/src/bfd/merge.c,v
retrieving revision 1.39
diff -c -3 -p -r1.39 merge.c
*** bfd/merge.c 11 Dec 2009 13:42:04 -0000 1.39
--- bfd/merge.c 20 Aug 2010 14:29:52 -0000
*************** sec_merge_emit (bfd *abfd, struct sec_me
*** 307,312 ****
--- 307,315 ----
len = -off & (entry->alignment - 1);
if (len != 0)
{
+ /* We should never have an entry with an alignment
+ greater than the section's alignment. */
+ BFD_ASSERT (len <= (bfd_size_type) (1 << alignment_power));
if (bfd_bwrite (pad, len, abfd) != len)
goto err;
off += len;
*************** sec_merge_emit (bfd *abfd, struct sec_me
*** 324,329 ****
--- 327,333 ----
/* Trailing alignment needed? */
off = sec->size - off;
if (off != 0
+ && alignment_power
&& bfd_bwrite (pad, off, abfd) != off)
goto err;
More information about the Binutils
mailing list