diff options
author | Nick Clifton <nickc@redhat.com> | 2015-01-07 16:41:25 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2015-01-07 16:41:25 +0000 |
commit | c88f5b8e495889f5d281a17bd56340d9a0e4cff6 (patch) | |
tree | 5e133afda04cfc1f388722a8887db5752a308e37 /binutils/objdump.c | |
parent | ea42d6f8d1e24403e533e5dfea18e94c47ac534b (diff) | |
download | gdb-c88f5b8e495889f5d281a17bd56340d9a0e4cff6.zip gdb-c88f5b8e495889f5d281a17bd56340d9a0e4cff6.tar.gz gdb-c88f5b8e495889f5d281a17bd56340d9a0e4cff6.tar.bz2 |
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.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c index a8c7d05..22e5ad6 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)); |