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.
This commit is contained in:
parent
0602cdad74
commit
cfd14a500e
6 changed files with 43 additions and 5 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue