aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-v850.c
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 /bfd/elf32-v850.c
parent0602cdad745472ed2561d8096a4bb021c8d0301d (diff)
downloadgdb-cfd14a500e0485374596234de4db10e88ebc7618.zip
gdb-cfd14a500e0485374596234de4db10e88ebc7618.tar.gz
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 'bfd/elf32-v850.c')
-rw-r--r--bfd/elf32-v850.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index 0e9ed5f..8db7507 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -2450,7 +2450,9 @@ v850_elf_copy_notes (bfd *ibfd, bfd *obfd)
BFD_ASSERT (bfd_malloc_and_get_section (ibfd, inotes, & icont));
if ((ocont = elf_section_data (onotes)->this_hdr.contents) == NULL)
- BFD_ASSERT (bfd_malloc_and_get_section (obfd, onotes, & ocont));
+ /* If the output is being stripped then it is possible for
+ the notes section to disappear. In this case do nothing. */
+ return;
/* Copy/overwrite notes from the input to the output. */
memcpy (ocont, icont, bfd_section_size (obfd, onotes));