PR binutils/16595
authorJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 17 Feb 2014 07:32:22 +0000 (08:32 +0100)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 17 Feb 2014 07:32:22 +0000 (08:32 +0100)
commit024a23103f04282872d4352302b1bfe04391a7a4
treebf0fa2895130e33389016dbb4c6625c2aed12464
parente7d1c40ce59ff355d2a51ff64a657c772eabbbfe
PR binutils/16595

abfd->section_count unexpectedly changes between 218 and 248 in:

150 bfd_simple_get_relocated_section_contents (bfd *abfd,
[...]
218   saved_offsets = malloc (sizeof (struct saved_output_info)
219                           * abfd->section_count);
[...]
230   _bfd_generic_link_add_symbols (abfd, &link_info);
[...]
248   bfd_map_over_sections (abfd, simple_restore_output_info, saved_offsets);

_bfd_generic_link_add_symbols increases section_count

and simple_restore_output_info later reads unallocated part of saved_offsets.

READ of size 8 at 0x601c0000c5c0 thread T0
    #0 0x1124770 in simple_restore_output_info (.../gdb/gdb+0x1124770)
    #1 0x10ecd51 in bfd_map_over_sections (.../gdb/gdb+0x10ecd51)
    #2 0x1125150 in bfd_simple_get_relocated_section_contents (.../gdb/gdb+0x1125150)

bfd/
2014-02-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

PR binutils/16595
* simple.c (struct saved_offsets): New.
(simple_save_output_info): Use it for ptr.
(simple_restore_output_info): Use it for ptr.  Check section_count.
(bfd_simple_get_relocated_section_contents): Use it for saved_offsets.
bfd/ChangeLog
bfd/simple.c
This page took 0.039048 seconds and 4 git commands to generate.