Blame SOURCES/binutils-CVE-2018-7642.patch

6cffa7
--- binutils.orig/bfd/aoutx.h	2018-05-29 17:35:09.220062492 +0100
6cffa7
+++ binutils-2.27/bfd/aoutx.h	2018-05-29 17:37:09.131765293 +0100
6cffa7
@@ -1713,7 +1713,13 @@ NAME (aout, translate_symbol_table) (bfd
6cffa7
       else if (x < strsize)
6cffa7
 	in->symbol.name = str + x;
6cffa7
       else
6cffa7
-	return FALSE;
6cffa7
+       {
6cffa7
+         _bfd_error_handler
6cffa7
+           (_("%B: invalid string offset %lx >= %lx"),
6cffa7
+            abfd, (long) x, (long) strsize);
6cffa7
+         bfd_set_error (bfd_error_bad_value);
6cffa7
+         return FALSE;
6cffa7
+       }
6cffa7
 
6cffa7
       in->symbol.value = GET_SWORD (abfd,  ext->e_value);
6cffa7
       in->desc = H_GET_16 (abfd, ext->e_desc);
6cffa7
@@ -2261,10 +2267,12 @@ NAME (aout, swap_std_reloc_in) (bfd *abf
6cffa7
   if (r_baserel)
6cffa7
     r_extern = 1;
6cffa7
 
6cffa7
-  if (r_extern && r_index > symcount)
6cffa7
+  if (r_extern && r_index >= symcount)
6cffa7
     {
6cffa7
       /* We could arrange to return an error, but it might be useful
6cffa7
-         to see the file even if it is bad.  */
6cffa7
+	 to see the file even if it is bad.  FIXME: Of course this
6cffa7
+	 means that objdump -r *doesn't* see the actual reloc, and
6cffa7
+	 objcopy silently writes a different reloc.  */
6cffa7
       r_extern = 0;
6cffa7
       r_index = N_ABS;
6cffa7
     }