Blame SOURCES/binutils-CVE-2019-17451.patch

7db648
--- binutils.orig/bfd/dwarf2.c	2019-11-13 11:32:09.395430104 +0000
7db648
+++ binutils-2.33.1/bfd/dwarf2.c	2019-11-13 11:33:17.272899503 +0000
7db648
@@ -4440,7 +4440,16 @@ _bfd_dwarf2_slurp_debug_info (bfd *abfd,
7db648
       for (total_size = 0;
7db648
 	   msec;
7db648
 	   msec = find_debug_info (debug_bfd, debug_sections, msec))
7db648
-	total_size += msec->size;
7db648
+       {
7db648
+         /* Catch PR25070 testcase overflowing size calculation here.  */
7db648
+         if (total_size + msec->size < total_size
7db648
+             || total_size + msec->size < msec->size)
7db648
+           {
7db648
+             bfd_set_error (bfd_error_no_memory);
7db648
+             return FALSE;
7db648
+           }
7db648
+         total_size += msec->size;
7db648
+       }
7db648
 
7db648
       stash->info_ptr_memory = (bfd_byte *) bfd_malloc (total_size);
7db648
       if (stash->info_ptr_memory == NULL)