Blame SOURCES/binutils-CVE-2021-20284.patch

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