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

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