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

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