Fix memory access violations exposed by running the srconv tool on fuzzed binaries.

PR binutils/17512
	* objdump.c (display_any_bfd): Add a depth limit to nested archive
	display in order to avoid infinite loops.
	* srconv.c: Replace calls to abort with calls to fatal with an
	error message.
This commit is contained in:
Nick Clifton
2015-01-07 16:41:25 +00:00
parent ea42d6f8d1
commit c88f5b8e49
3 changed files with 31 additions and 14 deletions

View File

@ -3406,9 +3406,16 @@ display_any_bfd (bfd *file, int level)
{
bfd *arfile = NULL;
bfd *last_arfile = NULL;
if (level == 0)
printf (_("In archive %s:\n"), bfd_get_filename (file));
else if (level > 100)
{
/* Prevent corrupted files from spinning us into an
infinite loop. 100 is an arbitrary heuristic. */
non_fatal (_("Archive nesting is too deep"));
return;
}
else
printf (_("In nested archive %s:\n"), bfd_get_filename (file));