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

869a11
--- binutils.orig/bfd/dwarf1.c	2018-05-01 13:04:35.060041875 +0100
869a11
+++ binutils-2.30/bfd/dwarf1.c	2018-05-01 13:24:17.943833855 +0100
869a11
@@ -213,6 +213,7 @@ parse_die (bfd *	     abfd,
869a11
   /* Then the attributes.  */
869a11
   while (xptr + 2 <= aDiePtrEnd)
869a11
     {
869a11
+      unsigned int   block_len;
869a11
       unsigned short attr;
869a11
 
869a11
       /* Parse the attribute based on its form.  This section
869a11
@@ -255,12 +256,24 @@ parse_die (bfd *	     abfd,
869a11
 	  break;
869a11
 	case FORM_BLOCK2:
869a11
 	  if (xptr + 2 <= aDiePtrEnd)
869a11
-	    xptr += bfd_get_16 (abfd, xptr);
869a11
+           {
869a11
+             block_len = bfd_get_16 (abfd, xptr);
869a11
+             if (xptr + block_len > aDiePtrEnd
869a11
+                 || xptr + block_len < xptr)
869a11
+               return FALSE;
869a11
+             xptr += block_len;
869a11
+           }
869a11
 	  xptr += 2;
869a11
 	  break;
869a11
 	case FORM_BLOCK4:
869a11
 	  if (xptr + 4 <= aDiePtrEnd)
869a11
-	    xptr += bfd_get_32 (abfd, xptr);
869a11
+           {
869a11
+             block_len = bfd_get_32 (abfd, xptr);
869a11
+             if (xptr + block_len > aDiePtrEnd
869a11
+                 || xptr + block_len < xptr)
869a11
+               return FALSE;
869a11
+             xptr += block_len;
869a11
+           }
869a11
 	  xptr += 4;
869a11
 	  break;
869a11
 	case FORM_STRING: