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

bf7c0a
diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.30/bfd/elf-bfd.h
bf7c0a
--- binutils.orig/bfd/elf-bfd.h	2021-05-19 15:05:30.988901261 +0100
bf7c0a
+++ binutils-2.30/bfd/elf-bfd.h	2021-05-19 15:05:55.477815716 +0100
bf7c0a
@@ -1487,7 +1487,7 @@ struct elf_backend_data
bf7c0a
   bfd_boolean (*init_secondary_reloc_section) (bfd *, Elf_Internal_Shdr *, const char *, unsigned int);
bf7c0a
 
bf7c0a
   /* Called when after loading the normal relocs for a section.  */
bf7c0a
-  bfd_boolean (*slurp_secondary_relocs) (bfd *, asection *, asymbol **);
bf7c0a
+  bfd_boolean (*slurp_secondary_relocs) (bfd *, asection *, asymbol **, bfd_boolean);
bf7c0a
 
bf7c0a
   /* Called after writing the normal relocs for a section.  */
bf7c0a
   bfd_boolean (*write_secondary_relocs) (bfd *, asection *);
bf7c0a
@@ -2721,7 +2721,7 @@ extern bfd_vma elf32_r_sym (bfd_vma);
bf7c0a
 extern bfd_boolean _bfd_elf_init_secondary_reloc_section
bf7c0a
   (bfd *, Elf_Internal_Shdr *, const char *, unsigned int);
bf7c0a
 extern bfd_boolean _bfd_elf_slurp_secondary_reloc_section
bf7c0a
-  (bfd *, asection *, asymbol **);
bf7c0a
+(bfd *, asection *, asymbol **, bfd_boolean);
bf7c0a
 extern bfd_boolean _bfd_elf_copy_special_section_fields
bf7c0a
   (const bfd *, bfd *, const Elf_Internal_Shdr *, Elf_Internal_Shdr *);
bf7c0a
 extern bfd_boolean _bfd_elf_write_secondary_reloc_section
bf7c0a
Only in binutils-2.30/bfd: elf-bfd.h.orig
bf7c0a
diff -rup binutils.orig/bfd/elf.c binutils-2.30/bfd/elf.c
bf7c0a
--- binutils.orig/bfd/elf.c	2021-05-19 15:05:30.989901257 +0100
bf7c0a
+++ binutils-2.30/bfd/elf.c	2021-05-19 15:05:55.478815712 +0100
bf7c0a
@@ -11663,7 +11663,8 @@ _bfd_elf_init_secondary_reloc_section (b
bf7c0a
 bfd_boolean
bf7c0a
 _bfd_elf_slurp_secondary_reloc_section (bfd *      abfd,
bf7c0a
 					asection * sec,
bf7c0a
-					asymbol ** symbols)
bf7c0a
+					asymbol ** symbols,
bf7c0a
+					bfd_boolean dynamic)
bf7c0a
 {
bf7c0a
   const struct elf_backend_data * const ebd = get_elf_backend_data (abfd);
bf7c0a
   asection * relsec;
bf7c0a
@@ -11728,7 +11729,10 @@ _bfd_elf_slurp_secondary_reloc_section (
bf7c0a
 	      continue;
bf7c0a
 	    }
bf7c0a
 
bf7c0a
-	  symcount = bfd_get_symcount (abfd);
bf7c0a
+         if (dynamic)
bf7c0a
+           symcount = bfd_get_dynamic_symcount (abfd);
bf7c0a
+         else
bf7c0a
+           symcount = bfd_get_symcount (abfd);
bf7c0a
 
bf7c0a
 	  for (i = 0, internal_reloc = internal_relocs, native_reloc = native_relocs;
bf7c0a
 	       i < reloc_count;
bf7c0a
Only in binutils-2.30/bfd: elf.c.orig
bf7c0a
diff -rup binutils.orig/bfd/elfcode.h binutils-2.30/bfd/elfcode.h
bf7c0a
--- binutils.orig/bfd/elfcode.h	2021-05-19 15:05:30.990901254 +0100
bf7c0a
+++ binutils-2.30/bfd/elfcode.h	2021-05-19 15:07:34.098471218 +0100
bf7c0a
@@ -1577,7 +1577,7 @@ elf_slurp_reloc_table (bfd *abfd,
bf7c0a
     return FALSE;
bf7c0a
 
bf7c0a
   if (bed->slurp_secondary_relocs != NULL
bf7c0a
-      && ! bed->slurp_secondary_relocs (abfd, asect, symbols))
bf7c0a
+      && ! bed->slurp_secondary_relocs (abfd, asect, symbols, dynamic))
bf7c0a
     return FALSE;
bf7c0a
 
bf7c0a
   asect->relocation = relents;
bf7c0a
Only in binutils-2.30/bfd: elfcode.h.orig
bf7c0a
Only in binutils-2.30/bfd: elfcode.h.rej