This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed, PATCH] x86: Guard against corrupted PLT


There should be only one entry in PLT for a given symbol.  Set howto to
NULL after processing a PLT entry to guard against corrupted PLT so that
the duplicated PLT entries are skipped.

Checked into master and will backport it to 2.29 branch.

H.J.
---
	PR binutils/22170
	* elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Guard against
	corrupted PLT.
---
 bfd/ChangeLog   | 6 ++++++
 bfd/elfxx-x86.c | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1c240793c1..9b4cb08d14 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
 2017-09-22  H.J. Lu  <hongjiu.lu@intel.com>
 
+	PR binutils/22170
+	* elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Guard against
+	corrupted PLT.
+
+2017-09-22  H.J. Lu  <hongjiu.lu@intel.com>
+
 	PR binutils/22163
 	* elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Also return
 	-1 if bfd_canonicalize_dynamic_reloc returns 0.
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index 11883ded36..dcc393b375 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -1962,6 +1962,10 @@ _bfd_x86_elf_get_synthetic_symtab (bfd *abfd,
 		names += sizeof ("@plt");
 		n++;
 		s++;
+		/* There should be only one entry in PLT for a given
+		   symbol.  Set howto to NULL after processing a PLT
+		   entry to guard against corrupted PLT.  */
+		p->howto = NULL;
 	      }
 	    offset += plt_entry_size;
 	  }
-- 
2.13.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]