aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-01-07 17:33:17 +0000
committerNick Clifton <nickc@redhat.com>2015-01-07 17:33:17 +0000
commitd7b24d2941fd7c99ba5843331989e6023075f0d0 (patch)
tree09af9e831a11b067800c3ae1c9e04a1c40f0389f
parentc88f5b8e495889f5d281a17bd56340d9a0e4cff6 (diff)
downloadfsf-binutils-gdb-d7b24d2941fd7c99ba5843331989e6023075f0d0.zip
fsf-binutils-gdb-d7b24d2941fd7c99ba5843331989e6023075f0d0.tar.gz
fsf-binutils-gdb-d7b24d2941fd7c99ba5843331989e6023075f0d0.tar.bz2
Fix memory access violations uncovered by running the dlltool on fuzzed binaries.
PR binutils/17512 * dlltool.c (scan_obj_file): Break loop if the last archive displayed matches the current archive.
-rw-r--r--binutils/ChangeLog3
-rw-r--r--binutils/dlltool.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 31a6696..17d2dd6 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,6 +1,9 @@
2015-01-07 Nick Clifton <nickc@redhat.com>
PR binutils/17512
+ * dlltool.c (scan_obj_file): Break loop if the last archive
+ displayed matches the current archive.
+
* 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
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index 7b0a3ce..10204b0 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -1699,6 +1699,9 @@ scan_obj_file (const char *filename)
scan_open_obj_file (arfile);
next = bfd_openr_next_archived_file (f, arfile);
bfd_close (arfile);
+ /* PR 17512: file: 58715298. */
+ if (next == arfile)
+ break;
arfile = next;
}