Fix read-after-free error in readelf when processing multiple, relocated sections...
authorNick Clifton <nickc@redhat.com>
Mon, 13 Feb 2017 14:03:22 +0000 (14:03 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 13 Feb 2017 14:03:22 +0000 (14:03 +0000)
commitf84ce13b6708801ca1d6289b7c4003e2f5a6d7f9
tree1e79fe5dc248e95d911d0df402e197a7daa94057
parent5cf30ebf64d3c6da961094c615a94d2f1682a478
Fix read-after-free error in readelf when processing multiple, relocated sections in an MSP430 binary.

PR binutils/21139
* readelf.c (target_specific_reloc_handling): Add num_syms
parameter.  Check for symbol table overflow before accessing
symbol value.  If reloc pointer is NULL, discard all saved state.
(apply_relocations): Pass num_syms to target_specific_reloc_handling.
Call target_specific_reloc_handling with a NULL reloc pointer
after processing all of the relocs.
binutils/ChangeLog
binutils/readelf.c