Prevent an attempt to allocate an excessive amount of memory when dumping the symbols in a malformed file.
PR 24707 * objdump.c (slurp_symtab): Fail with a helpful error message if the symbol table is too large.
This commit is contained in:
parent
999d6dff80
commit
781152ec18
|
@ -1,3 +1,9 @@
|
||||||
|
2019-06-28 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
PR 24707
|
||||||
|
* objdump.c (slurp_symtab): Fail with a helpful error message if
|
||||||
|
the symbol table is too large.
|
||||||
|
|
||||||
2019-06-26 Nick Clifton <nickc@redhat.com>
|
2019-06-26 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
PR 24703
|
PR 24703
|
||||||
|
|
|
@ -704,7 +704,22 @@ slurp_symtab (bfd *abfd)
|
||||||
bfd_fatal (_("error message was"));
|
bfd_fatal (_("error message was"));
|
||||||
}
|
}
|
||||||
if (storage)
|
if (storage)
|
||||||
sy = (asymbol **) xmalloc (storage);
|
{
|
||||||
|
off_t filesize = bfd_get_file_size (abfd);
|
||||||
|
|
||||||
|
/* qv PR 24707. */
|
||||||
|
if (filesize > 0 && filesize < storage)
|
||||||
|
{
|
||||||
|
bfd_nonfatal_message (bfd_get_filename (abfd), abfd, NULL,
|
||||||
|
_("error: symbol table size (%#lx) is larger than filesize (%#lx)"),
|
||||||
|
storage, (long) filesize);
|
||||||
|
exit_status = 1;
|
||||||
|
symcount = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
sy = (asymbol **) xmalloc (storage);
|
||||||
|
}
|
||||||
|
|
||||||
symcount = bfd_canonicalize_symtab (abfd, sy);
|
symcount = bfd_canonicalize_symtab (abfd, sy);
|
||||||
if (symcount < 0)
|
if (symcount < 0)
|
||||||
|
|
Loading…
Reference in New Issue