summaryrefslogtreecommitdiff
path: root/binutils/objdump.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-01-07 16:41:25 +0000
committerNick Clifton <nickc@redhat.com>2015-01-07 16:41:25 +0000
commitc88f5b8e495889f5d281a17bd56340d9a0e4cff6 (patch)
tree5e133afda04cfc1f388722a8887db5752a308e37 /binutils/objdump.c
parentea42d6f8d1e24403e533e5dfea18e94c47ac534b (diff)
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.
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r--binutils/objdump.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index a8c7d05f1e..22e5ad66d8 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -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));