binutils/binutils-CVE-2018-6323.patch
Nick Clifton f53b235000 Fix a seg-fault parsing corrupt DWARF information. (#1573360)
Fix another seg-fault parsing corrupt DWARF information.  (#1573367)
Fix a seg-fault copying a corrupt ELF file.  (#1551788)
Fix a seg-fault parsing a large ELF files on a 32-bit host.  (#1539891)
Fix a seg-fault running nm on a corrupt ELF file.  (#15343247)
Fix a seg-fault running nm on a file containing corrupt DWARF information.  (#1551781)
Fix another seg-fault running nm on a file containing corrupt DWARF information.  (#1551763)
2018-05-01 15:15:23 +01:00

21 lines
926 B
Diff

--- binutils.orig/bfd/elfcode.h 2018-05-01 11:42:03.250424443 +0100
+++ binutils-2.30/bfd/elfcode.h 2018-05-01 12:41:00.745780026 +0100
@@ -680,7 +680,7 @@ elf_object_p (bfd *abfd)
if (i_ehdrp->e_shnum > ((bfd_size_type) -1) / sizeof (*i_shdrp))
goto got_wrong_format_error;
#endif
- amt = sizeof (*i_shdrp) * i_ehdrp->e_shnum;
+ amt = sizeof (*i_shdrp) * (bfd_size_type) i_ehdrp->e_shnum;
i_shdrp = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
if (!i_shdrp)
goto got_no_match;
@@ -776,7 +776,7 @@ elf_object_p (bfd *abfd)
if (i_ehdrp->e_phnum > ((bfd_size_type) -1) / sizeof (*i_phdr))
goto got_wrong_format_error;
#endif
- amt = i_ehdrp->e_phnum * sizeof (*i_phdr);
+ amt = (bfd_size_type) i_ehdrp->e_phnum * sizeof (*i_phdr);
elf_tdata (abfd)->phdr = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
if (elf_tdata (abfd)->phdr == NULL)
goto got_no_match;