]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
x86: Guard against corrupted PLT
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 22 Sep 2017 21:15:40 +0000 (14:15 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 22 Sep 2017 21:37:47 +0000 (14:37 -0700)
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
 * elf32-i386.c (elf_i386_get_synthetic_symtab): Guard against
 corrupted PLT.
 * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.

(cherry picked from commit 61e3bf5f83f7e505b6bc51ef65426e5b31e6e360)

bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf64-x86-64.c

index 31e2a7f9c61f7ddace581a2879b62a6d794e46cf..7091d7543ff0b819a8072b678f410680baae3b58 100644 (file)
@@ -1,3 +1,10 @@
+2017-09-22  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR binutils/22170
+       * elf32-i386.c (elf_i386_get_synthetic_symtab): Guard against
+       corrupted PLT.
+       * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
+
 2017-09-22  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR binutils/22163
index 9dc2d25863fecfb6224beac8df5bb23030c42add..ba50c93f33e451638354eefb81f8f038bdcc6fd6 100644 (file)
@@ -6616,6 +6616,10 @@ bad_return:
                  size += sizeof ("+0x") - 1 + 8;
                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;
          }
index 558db98c4a7af243873fbb948d72abb57723ffbe..d9225addddcfb258bb99b82a3a08c18e8b9624b2 100644 (file)
@@ -6970,6 +6970,10 @@ bad_return:
                  size += sizeof ("+0x") - 1 + 8 + 8 * ABI_64_P (abfd);
                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;
          }