• 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

修訂f2023ce7e8d70b0155cc6206c901e185260918f0 (tree)
時間2018-02-01 20:08:02
作者Alan Modra <amodra@gmai...>
CommiterAlan Modra

Log Message

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

PR 22769
* objdump.c (load_specific_debug_section): Check for overflow
when adding one to section size for a string section terminator.

Change Summary

差異

--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
1+2018-02-01 Alan Modra <amodra@gmail.com>
2+
3+ PR 22769
4+ * objdump.c (load_specific_debug_section): Check for overflow
5+ when adding one to section size for a string section terminator.
6+
17 2018-01-30 Nick Clifton <nickc@redhat.com>
28
39 PR 22734
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -2466,6 +2466,7 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
24662466 struct dwarf_section *section = &debug_displays [debug].section;
24672467 bfd *abfd = (bfd *) file;
24682468 bfd_byte *contents;
2469+ bfd_size_type amt;
24692470
24702471 if (section->start != NULL)
24712472 {
@@ -2480,9 +2481,11 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
24802481 section->num_relocs = 0;
24812482 section->address = bfd_get_section_vma (abfd, sec);
24822483 section->size = bfd_get_section_size (sec);
2483- section->start = contents = malloc (section->size + 1);
2484+ amt = section->size + 1;
2485+ section->start = contents = malloc (amt);
24842486 section->user_data = sec;
2485- if (section->start == NULL
2487+ if (amt == 0
2488+ || section->start == NULL
24862489 || !bfd_get_full_section_contents (abfd, sec, &contents))
24872490 {
24882491 free_debug_section (debug);