This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Prevent a run time segmentation fault when stripping a corrupt binary.
- From: Nick Clifton <nickc at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 18 May 2016 14:21:49 -0000
- Subject: [binutils-gdb] Prevent a run time segmentation fault when stripping a corrupt binary.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f507bebf459de9b145bd8ccfcfa2f5f6690adac4
commit f507bebf459de9b145bd8ccfcfa2f5f6690adac4
Author: Nick Clifton <nickc@redhat.com>
Date: Wed May 18 15:21:16 2016 +0100
Prevent a run time segmentation fault when stripping a corrupt binary.
PR 20096
* objcopy.c (copy_relocations_in_section): Also check for the
symbol pointed to by sym_ptr_ptr being NULL.
Diff:
---
binutils/ChangeLog | 6 ++++++
binutils/objcopy.c | 4 +++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index c4bb34e..64b409e 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2016-05-18 Nick Clifton <nickc@redhat.com>
+
+ PR 20096
+ * objcopy.c (copy_relocations_in_section): Also check for the
+ symbol pointed to by sym_ptr_ptr being NULL.
+
2016-05-18 Maciej W. Rozycki <macro@imgtec.com>
* testsuite/binutils-all/mips/mixed-mips16-micromips.d: New test.
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 198ba3a..0b21899 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -3250,7 +3250,9 @@ copy_relocations_in_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
for (i = 0; i < relcount; i++)
{
/* PR 17512: file: 9e907e0c. */
- if (relpp[i]->sym_ptr_ptr)
+ if (relpp[i]->sym_ptr_ptr
+ /* PR 20096 */
+ && * relpp[i]->sym_ptr_ptr)
if (is_specified_symbol (bfd_asymbol_name (*relpp[i]->sym_ptr_ptr),
keep_specific_htab))
temp_relpp [temp_relcount++] = relpp [i];