binutils/SOURCES/binutils-CVE-2021-20284.patch
2021-10-06 15:46:49 +00:00

63 lines
2.7 KiB
Diff

diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.30/bfd/elf-bfd.h
--- binutils.orig/bfd/elf-bfd.h 2021-05-19 15:05:30.988901261 +0100
+++ binutils-2.30/bfd/elf-bfd.h 2021-05-19 15:05:55.477815716 +0100
@@ -1487,7 +1487,7 @@ struct elf_backend_data
bfd_boolean (*init_secondary_reloc_section) (bfd *, Elf_Internal_Shdr *, 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 *);
@@ -2721,7 +2721,7 @@ extern bfd_vma elf32_r_sym (bfd_vma);
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
Only in binutils-2.30/bfd: elf-bfd.h.orig
diff -rup binutils.orig/bfd/elf.c binutils-2.30/bfd/elf.c
--- binutils.orig/bfd/elf.c 2021-05-19 15:05:30.989901257 +0100
+++ binutils-2.30/bfd/elf.c 2021-05-19 15:05:55.478815712 +0100
@@ -11663,7 +11663,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;
@@ -11728,7 +11729,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;
i < reloc_count;
Only in binutils-2.30/bfd: elf.c.orig
diff -rup binutils.orig/bfd/elfcode.h binutils-2.30/bfd/elfcode.h
--- binutils.orig/bfd/elfcode.h 2021-05-19 15:05:30.990901254 +0100
+++ binutils-2.30/bfd/elfcode.h 2021-05-19 15:07:34.098471218 +0100
@@ -1577,7 +1577,7 @@ elf_slurp_reloc_table (bfd *abfd,
return FALSE;
if (bed->slurp_secondary_relocs != NULL
- && ! bed->slurp_secondary_relocs (abfd, asect, symbols))
+ && ! bed->slurp_secondary_relocs (abfd, asect, symbols, dynamic))
return FALSE;
asect->relocation = relents;
Only in binutils-2.30/bfd: elfcode.h.orig
Only in binutils-2.30/bfd: elfcode.h.rej