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

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