From 61e3bf5f83f7e505b6bc51ef65426e5b31e6e360 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 22 Sep 2017 14:15:40 -0700 Subject: [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. 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 1c240793c1f..9b4cb08d14e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2017-09-22 H.J. Lu + + PR binutils/22170 + * elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Guard against + corrupted PLT. + 2017-09-22 H.J. Lu PR binutils/22163 diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index 11883ded36c..dcc393b3750 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.30.2