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

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