|
|
1212c94 |
diff -rup binutils.orig/bfd/elf32-i386.c binutils-2.29/bfd/elf32-i386.c
|
|
|
1212c94 |
--- binutils.orig/bfd/elf32-i386.c 2018-05-31 10:14:28.059641441 +0100
|
|
|
1212c94 |
+++ binutils-2.29/bfd/elf32-i386.c 2018-05-31 10:15:09.362194799 +0100
|
|
|
1212c94 |
@@ -6376,7 +6376,7 @@ elf_i386_get_synthetic_symtab (bfd *abfd
|
|
|
1212c94 |
for (j = 0; plts[j].name != NULL; j++)
|
|
|
1212c94 |
{
|
|
|
1212c94 |
plt = bfd_get_section_by_name (abfd, plts[j].name);
|
|
|
1212c94 |
- if (plt == NULL)
|
|
|
1212c94 |
+ if (plt == NULL || plt->size == 0)
|
|
|
1212c94 |
continue;
|
|
|
1212c94 |
|
|
|
1212c94 |
/* Get the PLT section contents. */
|
|
|
1212c94 |
@@ -6392,7 +6392,9 @@ elf_i386_get_synthetic_symtab (bfd *abfd
|
|
|
1212c94 |
|
|
|
1212c94 |
/* Check what kind of PLT it is. */
|
|
|
1212c94 |
plt_type = plt_unknown;
|
|
|
1212c94 |
- if (plts[j].type == plt_unknown)
|
|
|
1212c94 |
+ if (plts[j].type == plt_unknown
|
|
|
1212c94 |
+ && (plt->size >= (lazy_plt->plt0_entry_size
|
|
|
1212c94 |
+ + lazy_plt->plt_entry_size)))
|
|
|
1212c94 |
{
|
|
|
1212c94 |
/* Match lazy PLT first. */
|
|
|
1212c94 |
if (memcmp (plt_contents, lazy_plt->plt0_entry,
|
|
|
1212c94 |
@@ -6401,7 +6403,7 @@ elf_i386_get_synthetic_symtab (bfd *abfd
|
|
|
1212c94 |
/* The fist entry in the lazy IBT PLT is the same as the
|
|
|
1212c94 |
normal lazy PLT. */
|
|
|
1212c94 |
if (lazy_ibt_plt != NULL
|
|
|
1212c94 |
- && (memcmp (plt_contents + lazy_ibt_plt->plt_entry_size,
|
|
|
1212c94 |
+ && (memcmp (plt_contents + lazy_ibt_plt->plt0_entry_size,
|
|
|
1212c94 |
lazy_ibt_plt->plt_entry,
|
|
|
1212c94 |
lazy_ibt_plt->plt_got_offset) == 0))
|
|
|
1212c94 |
plt_type = plt_lazy | plt_second;
|
|
|
1212c94 |
@@ -6414,7 +6416,7 @@ elf_i386_get_synthetic_symtab (bfd *abfd
|
|
|
1212c94 |
/* The fist entry in the PIC lazy IBT PLT is the same as
|
|
|
1212c94 |
the normal PIC lazy PLT. */
|
|
|
1212c94 |
if (lazy_ibt_plt != NULL
|
|
|
1212c94 |
- && (memcmp (plt_contents + lazy_ibt_plt->plt_entry_size,
|
|
|
1212c94 |
+ && (memcmp (plt_contents + lazy_ibt_plt->plt0_entry_size,
|
|
|
1212c94 |
lazy_ibt_plt->pic_plt_entry,
|
|
|
1212c94 |
lazy_ibt_plt->plt_got_offset) == 0))
|
|
|
1212c94 |
plt_type = plt_lazy | plt_pic | plt_second;
|
|
|
1212c94 |
@@ -6424,7 +6426,8 @@ elf_i386_get_synthetic_symtab (bfd *abfd
|
|
|
1212c94 |
}
|
|
|
1212c94 |
|
|
|
1212c94 |
if (non_lazy_plt != NULL
|
|
|
1212c94 |
- && (plt_type == plt_unknown || plt_type == plt_non_lazy))
|
|
|
1212c94 |
+ && (plt_type == plt_unknown || plt_type == plt_non_lazy)
|
|
|
1212c94 |
+ && plt->size >= non_lazy_plt->plt_entry_size)
|
|
|
1212c94 |
{
|
|
|
1212c94 |
/* Match non-lazy PLT. */
|
|
|
1212c94 |
if (memcmp (plt_contents, non_lazy_plt->plt_entry,
|
|
|
1212c94 |
@@ -6436,7 +6439,8 @@ elf_i386_get_synthetic_symtab (bfd *abfd
|
|
|
1212c94 |
}
|
|
|
1212c94 |
|
|
|
1212c94 |
if ((non_lazy_ibt_plt != NULL)
|
|
|
1212c94 |
- && (plt_type == plt_unknown || plt_type == plt_second))
|
|
|
1212c94 |
+ && (plt_type == plt_unknown || plt_type == plt_second)
|
|
|
1212c94 |
+ && plt->size >= non_lazy_ibt_plt->plt_entry_size)
|
|
|
1212c94 |
{
|
|
|
1212c94 |
if (memcmp (plt_contents,
|
|
|
1212c94 |
non_lazy_ibt_plt->plt_entry,
|
|
|
1212c94 |
@@ -6494,6 +6498,9 @@ elf_i386_get_synthetic_symtab (bfd *abfd
|
|
|
1212c94 |
got_addr = (bfd_vma) -1;
|
|
|
1212c94 |
}
|
|
|
1212c94 |
|
|
|
1212c94 |
+ if (count == 0)
|
|
|
1212c94 |
+ return -1;
|
|
|
1212c94 |
+
|
|
|
1212c94 |
size = count * sizeof (asymbol);
|
|
|
1212c94 |
s = *ret = (asymbol *) bfd_zmalloc (size);
|
|
|
1212c94 |
if (s == NULL)
|
|
|
1212c94 |
Only in binutils-2.29/bfd/: elf32-i386.c.orig
|
|
|
1212c94 |
diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.29/bfd/elf64-x86-64.c
|
|
|
1212c94 |
--- binutils.orig/bfd/elf64-x86-64.c 2018-05-31 10:14:28.078641236 +0100
|
|
|
1212c94 |
+++ binutils-2.29/bfd/elf64-x86-64.c 2018-05-31 10:15:25.284022632 +0100
|
|
|
1212c94 |
@@ -6756,7 +6756,7 @@ elf_x86_64_get_synthetic_symtab (bfd *ab
|
|
|
1212c94 |
for (j = 0; plts[j].name != NULL; j++)
|
|
|
1212c94 |
{
|
|
|
1212c94 |
plt = bfd_get_section_by_name (abfd, plts[j].name);
|
|
|
1212c94 |
- if (plt == NULL)
|
|
|
1212c94 |
+ if (plt == NULL || plt->size == 0)
|
|
|
1212c94 |
continue;
|
|
|
1212c94 |
|
|
|
1212c94 |
/* Get the PLT section contents. */
|
|
|
1212c94 |
@@ -6772,7 +6772,9 @@ elf_x86_64_get_synthetic_symtab (bfd *ab
|
|
|
1212c94 |
|
|
|
1212c94 |
/* Check what kind of PLT it is. */
|
|
|
1212c94 |
plt_type = plt_unknown;
|
|
|
1212c94 |
- if (plts[j].type == plt_unknown)
|
|
|
1212c94 |
+ if (plts[j].type == plt_unknown
|
|
|
1212c94 |
+ && (plt->size >= (lazy_plt->plt_entry_size
|
|
|
1212c94 |
+ + lazy_plt->plt_entry_size)))
|
|
|
1212c94 |
{
|
|
|
1212c94 |
/* Match lazy PLT first. Need to check the first two
|
|
|
1212c94 |
instructions. */
|
|
|
1212c94 |
@@ -6800,7 +6802,8 @@ elf_x86_64_get_synthetic_symtab (bfd *ab
|
|
|
1212c94 |
}
|
|
|
1212c94 |
|
|
|
1212c94 |
if (non_lazy_plt != NULL
|
|
|
1212c94 |
- && (plt_type == plt_unknown || plt_type == plt_non_lazy))
|
|
|
1212c94 |
+ && (plt_type == plt_unknown || plt_type == plt_non_lazy)
|
|
|
1212c94 |
+ && plt->size >= non_lazy_plt->plt_entry_size)
|
|
|
1212c94 |
{
|
|
|
1212c94 |
/* Match non-lazy PLT. */
|
|
|
1212c94 |
if (memcmp (plt_contents, non_lazy_plt->plt_entry,
|
|
|
1212c94 |
@@ -6811,6 +6814,7 @@ elf_x86_64_get_synthetic_symtab (bfd *ab
|
|
|
1212c94 |
if (plt_type == plt_unknown || plt_type == plt_second)
|
|
|
1212c94 |
{
|
|
|
1212c94 |
if (non_lazy_bnd_plt != NULL
|
|
|
1212c94 |
+ && plt->size >= non_lazy_bnd_plt->plt_entry_size
|
|
|
1212c94 |
&& (memcmp (plt_contents, non_lazy_bnd_plt->plt_entry,
|
|
|
1212c94 |
non_lazy_bnd_plt->plt_got_offset) == 0))
|
|
|
1212c94 |
{
|
|
|
1212c94 |
@@ -6819,6 +6823,7 @@ elf_x86_64_get_synthetic_symtab (bfd *ab
|
|
|
1212c94 |
non_lazy_plt = non_lazy_bnd_plt;
|
|
|
1212c94 |
}
|
|
|
1212c94 |
else if (non_lazy_ibt_plt != NULL
|
|
|
1212c94 |
+ && plt->size >= non_lazy_ibt_plt->plt_entry_size
|
|
|
1212c94 |
&& (memcmp (plt_contents,
|
|
|
1212c94 |
non_lazy_ibt_plt->plt_entry,
|
|
|
1212c94 |
non_lazy_ibt_plt->plt_got_offset) == 0))
|
|
|
1212c94 |
@@ -6864,6 +6869,9 @@ elf_x86_64_get_synthetic_symtab (bfd *ab
|
|
|
1212c94 |
plts[j].contents = plt_contents;
|
|
|
1212c94 |
}
|
|
|
1212c94 |
|
|
|
1212c94 |
+ if (count == 0)
|
|
|
1212c94 |
+ return -1;
|
|
|
1212c94 |
+
|
|
|
1212c94 |
size = count * sizeof (asymbol);
|
|
|
1212c94 |
s = *ret = (asymbol *) bfd_zmalloc (size);
|
|
|
1212c94 |
if (s == NULL)
|
|
|
1212c94 |
Only in binutils-2.29/bfd/: elf64-x86-64.c.orig
|