From d7b24d2941fd7c99ba5843331989e6023075f0d0 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 7 Jan 2015 17:33:17 +0000 Subject: [PATCH] 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. --- binutils/ChangeLog | 3 +++ binutils/dlltool.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 31a66963c5f..17d2dd670db 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,6 +1,9 @@ 2015-01-07 Nick Clifton 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 7b0a3cefe3a..10204b08885 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; } -- 2.30.2