aboutsummaryrefslogtreecommitdiff
path: root/binutils/objcopy.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-12-06 16:26:42 +0000
committerNick Clifton <nickc@redhat.com>2016-12-06 16:26:42 +0000
commit8b929e420a810afe23d5ba57a98109c74d1d5816 (patch)
treeddd34404fc19629ed6edc0d7cd931eeb6adc5c43 /binutils/objcopy.c
parent92744f058094edd0b29bf9762f4ac26e4c6743c2 (diff)
downloadgdb-8b929e420a810afe23d5ba57a98109c74d1d5816.zip
gdb-8b929e420a810afe23d5ba57a98109c74d1d5816.tar.gz
gdb-8b929e420a810afe23d5ba57a98109c74d1d5816.tar.bz2
Fix seg-fault running strip on a corrupt binary.
PR binutils/20930 * objcopy.c (mark_symbols_used_in_relocations): Check for a null symbol pointer pointer before attempting to mark the symbol as kept.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r--binutils/objcopy.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 6a398ce..c780012 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -3551,8 +3551,9 @@ mark_symbols_used_in_relocations (bfd *ibfd, sec_ptr isection, void *symbolsarg)
special bfd section symbols, then mark it with BSF_KEEP. */
for (i = 0; i < relcount; i++)
{
- /* See PR 20923 for a reproducer for the NULL test. */
+ /* See PRs 20923 and 20930 for reproducers for the NULL tests. */
if (relpp[i]->sym_ptr_ptr != NULL
+ && * relpp[i]->sym_ptr_ptr != NULL
&& *relpp[i]->sym_ptr_ptr != bfd_com_section_ptr->symbol
&& *relpp[i]->sym_ptr_ptr != bfd_abs_section_ptr->symbol
&& *relpp[i]->sym_ptr_ptr != bfd_und_section_ptr->symbol)