mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-21 18:39:34 +08:00
ELF core file size checks
Catch fuzzed segments where p_offset + p_filesz wraps, and limit error output. * elfcore.h (elf_core_file_p): Rewrite segment checks using bfd_get_file_size. Set read_only on file size errors. * elfcode.h (elf_swap_shdr_in): Don't repeat error message.
This commit is contained in:
@ -325,9 +325,10 @@ elf_swap_shdr_in (bfd *abfd,
|
||||
&& ((ufile_ptr) dst->sh_offset > filesize
|
||||
|| dst->sh_size > filesize - dst->sh_offset))
|
||||
{
|
||||
if (!abfd->read_only)
|
||||
_bfd_error_handler (_("warning: %pB has a section "
|
||||
"extending past end of file"), abfd);
|
||||
abfd->read_only = 1;
|
||||
_bfd_error_handler (_("warning: %pB has a section "
|
||||
"extending past end of file"), abfd);
|
||||
}
|
||||
}
|
||||
dst->sh_link = H_GET_32 (abfd, src->sh_link);
|
||||
|
Reference in New Issue
Block a user