Prevent attempts to allocate excessive amounts of memory when parsing corrupt ELF files.
PR 24708 * elf.c (_bfd_elf_slurp_version_tables): Check for an excessively large version reference section. * compress.c (bfd_get_full_section_contents): Check for an uncompressed section whose size is larger than the file size.
This commit is contained in:
parent
781152ec18
commit
7e56c51c79
5 changed files with 44 additions and 2 deletions
|
@ -708,7 +708,11 @@ slurp_symtab (bfd *abfd)
|
|||
off_t filesize = bfd_get_file_size (abfd);
|
||||
|
||||
/* qv PR 24707. */
|
||||
if (filesize > 0 && filesize < storage)
|
||||
if (filesize > 0
|
||||
&& filesize < storage
|
||||
/* The MMO file format supports its own special compression
|
||||
technique, so its sections can be larger than the file size. */
|
||||
&& bfd_get_flavour (abfd) != bfd_target_mmo_flavour)
|
||||
{
|
||||
bfd_nonfatal_message (bfd_get_filename (abfd), abfd, NULL,
|
||||
_("error: symbol table size (%#lx) is larger than filesize (%#lx)"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue