• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修訂38e64b0ecc7f4ee64a02514b8d532782ac057fa2 (tree)
時間2018-01-25 20:35:10
作者Alan Modra <amodra@gmai...>
CommiterAlan Modra

Log Message

PR22746, crash when running 32-bit objdump on corrupted file

Avoid unsigned int overflow by performing bfd_size_type multiplication.

PR 22746
* elfcode.h (elf_object_p): Avoid integer overflow.

Change Summary

差異

--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
1+2018-01-25 Alan Modra <amodra@gmail.com>
2+
3+ PR 22746
4+ * elfcode.h (elf_object_p): Avoid integer overflow.
5+
16 2018-01-25 Eric Botcazou <ebotcazou@adacore.com>
27
38 PR ld/22727
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -680,7 +680,7 @@ elf_object_p (bfd *abfd)
680680 if (i_ehdrp->e_shnum > ((bfd_size_type) -1) / sizeof (*i_shdrp))
681681 goto got_wrong_format_error;
682682 #endif
683- amt = sizeof (*i_shdrp) * i_ehdrp->e_shnum;
683+ amt = sizeof (*i_shdrp) * (bfd_size_type) i_ehdrp->e_shnum;
684684 i_shdrp = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
685685 if (!i_shdrp)
686686 goto got_no_match;
@@ -776,7 +776,7 @@ elf_object_p (bfd *abfd)
776776 if (i_ehdrp->e_phnum > ((bfd_size_type) -1) / sizeof (*i_phdr))
777777 goto got_wrong_format_error;
778778 #endif
779- amt = i_ehdrp->e_phnum * sizeof (*i_phdr);
779+ amt = (bfd_size_type) i_ehdrp->e_phnum * sizeof (*i_phdr);
780780 elf_tdata (abfd)->phdr = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
781781 if (elf_tdata (abfd)->phdr == NULL)
782782 goto got_no_match;