diff options
author | Alan Modra <amodra@gmail.com> | 2020-08-03 11:01:27 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-08-03 14:07:31 +0930 |
commit | b5f386d52049067ca081651a460ab4ae85e327d4 (patch) | |
tree | c3e7492c0f10b8c152599fe572e40f88933b0dc2 /bfd/elf64-x86-64.c | |
parent | ee44c2ac7b3efdfd28c41cd32d7fb935b0582a97 (diff) | |
download | gdb-b5f386d52049067ca081651a460ab4ae85e327d4.zip gdb-b5f386d52049067ca081651a460ab4ae85e327d4.tar.gz gdb-b5f386d52049067ca081651a460ab4ae85e327d4.tar.bz2 |
PR26330, Malloc size error in objdump
PR 26330
* elf.c (_bfd_elf_get_symtab_upper_bound): Sanity check symbol table
size against file size. Correct LONG_MAX limit check.
(_bfd_elf_get_dynamic_symtab_upper_bound): Likewise.
(_bfd_elf_get_reloc_upper_bound): Don't check file size if writing.
(_bfd_elf_get_dynamic_reloc_upper_bound): Likewise.
* elf64-x86-64-.c (elf_x86_64_get_synthetic_symtab): Use
bfd_malloc_and_get_section.
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r-- | bfd/elf64-x86-64.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index f97a6a0..549a8be 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -4810,15 +4810,8 @@ elf_x86_64_get_synthetic_symtab (bfd *abfd, continue; /* Get the PLT section contents. */ - plt_contents = (bfd_byte *) bfd_malloc (plt->size); - if (plt_contents == NULL) + if (!bfd_malloc_and_get_section (abfd, plt, &plt_contents)) break; - if (!bfd_get_section_contents (abfd, (asection *) plt, - plt_contents, 0, plt->size)) - { - free (plt_contents); - break; - } /* Check what kind of PLT it is. */ plt_type = plt_unknown; |