aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2017-06-26 15:25:08 +0100
committerNick Clifton <nickc@redhat.com>2017-06-26 15:25:08 +0100
commitcfd14a500e0485374596234de4db10e88ebc7618 (patch)
tree5627cf743e8fc9646606e13bd6227fe959636bd5 /binutils
parent0602cdad745472ed2561d8096a4bb021c8d0301d (diff)
downloadfsf-binutils-gdb-cfd14a500e0485374596234de4db10e88ebc7618.zip
fsf-binutils-gdb-cfd14a500e0485374596234de4db10e88ebc7618.tar.gz
fsf-binutils-gdb-cfd14a500e0485374596234de4db10e88ebc7618.tar.bz2
Fix address violations when atempting to parse fuzzed binaries.
PR binutils/21665 bfd * opncls.c (get_build_id): Check that the section is beig enough to contain the whole note. * compress.c (bfd_get_full_section_contents): Check for and reject a section whoes size is greater than the size of the entire file. * elf32-v850.c (v850_elf_copy_notes): Allow for the ouput to not contain a notes section. binutils* objdump.c (disassemble_section): Skip any section that is bigger than the entire file.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/objdump.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 6810c22..af2a348 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,11 @@
2017-06-26 Nick Clifton <nickc@redhat.com>
+ PR binutils/21665
+ * objdump.c (disassemble_section): Skip any section that is bigger
+ than the entire file.
+
+2017-06-26 Nick Clifton <nickc@redhat.com>
+
PR binutils/21659
* bucomm.c (get_file_size): Explicitly warn if the file is a
directory.
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 16e1f0e..ed8c645 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -2114,7 +2114,7 @@ disassemble_section (bfd *abfd, asection *section, void *inf)
return;
datasize = bfd_get_section_size (section);
- if (datasize == 0)
+ if (datasize == 0 || datasize >= (bfd_size_type) bfd_get_file_size (abfd))
return;
if (start_address == (bfd_vma) -1
@@ -2985,7 +2985,7 @@ dump_target_specific (bfd *abfd)
static void
dump_section (bfd *abfd, asection *section, void *dummy ATTRIBUTE_UNUSED)
{
- bfd_byte *data = 0;
+ bfd_byte *data = NULL;
bfd_size_type datasize;
bfd_vma addr_offset;
bfd_vma start_offset;