binutils/binutils-CVE-2021-20284.patch
2021-03-17 14:17:31 +00:00

59 lines
2.5 KiB
Diff

diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.35.1/bfd/elf-bfd.h
--- binutils.orig/bfd/elf-bfd.h 2021-03-12 12:20:04.495125388 +0000
+++ binutils-2.35.1/bfd/elf-bfd.h 2021-03-12 12:21:25.696583280 +0000
@@ -1562,7 +1562,7 @@ struct elf_backend_data
const char *, unsigned int);
/* Called when after loading the normal relocs for a section. */
- bfd_boolean (*slurp_secondary_relocs) (bfd *, asection *, asymbol **);
+ bfd_boolean (*slurp_secondary_relocs) (bfd *, asection *, asymbol **, bfd_boolean);
/* Called after writing the normal relocs for a section. */
bfd_boolean (*write_secondary_relocs) (bfd *, asection *);
@@ -2909,7 +2909,7 @@ extern bfd_boolean is_debuginfo_file (bf
extern bfd_boolean _bfd_elf_init_secondary_reloc_section
(bfd *, Elf_Internal_Shdr *, const char *, unsigned int);
extern bfd_boolean _bfd_elf_slurp_secondary_reloc_section
- (bfd *, asection *, asymbol **);
+(bfd *, asection *, asymbol **, bfd_boolean);
extern bfd_boolean _bfd_elf_copy_special_section_fields
(const bfd *, bfd *, const Elf_Internal_Shdr *, Elf_Internal_Shdr *);
extern bfd_boolean _bfd_elf_write_secondary_reloc_section
diff -rup binutils.orig/bfd/elf.c binutils-2.35.1/bfd/elf.c
--- binutils.orig/bfd/elf.c 2021-03-12 12:20:04.496125381 +0000
+++ binutils-2.35.1/bfd/elf.c 2021-03-12 12:20:46.032848074 +0000
@@ -12513,7 +12513,8 @@ _bfd_elf_init_secondary_reloc_section (b
bfd_boolean
_bfd_elf_slurp_secondary_reloc_section (bfd * abfd,
asection * sec,
- asymbol ** symbols)
+ asymbol ** symbols,
+ bfd_boolean dynamic)
{
const struct elf_backend_data * const ebd = get_elf_backend_data (abfd);
asection * relsec;
@@ -12590,7 +12591,10 @@ _bfd_elf_slurp_secondary_reloc_section (
continue;
}
- symcount = bfd_get_symcount (abfd);
+ if (dynamic)
+ symcount = bfd_get_dynamic_symcount (abfd);
+ else
+ symcount = bfd_get_symcount (abfd);
for (i = 0, internal_reloc = internal_relocs,
native_reloc = native_relocs;
diff -rup binutils.orig/bfd/elfcode.h binutils-2.35.1/bfd/elfcode.h
--- binutils.orig/bfd/elfcode.h 2021-03-12 12:20:04.533125134 +0000
+++ binutils-2.35.1/bfd/elfcode.h 2021-03-12 12:21:59.568357132 +0000
@@ -1591,7 +1591,7 @@ elf_slurp_reloc_table (bfd *abfd,
symbols, dynamic))
return FALSE;
- if (!bed->slurp_secondary_relocs (abfd, asect, symbols))
+ if (!bed->slurp_secondary_relocs (abfd, asect, symbols, dynamic))
return FALSE;
asect->relocation = relents;