http://sourceware.org/bugzilla/show_bug.cgi?id=15151
--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> 2013-02-15 18:20:38 UTC --- diff --git a/bfd/archive.c b/bfd/archive.c index e4183ea..4b6a81c 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -619,6 +617,7 @@ _bfd_append_relative_path (bfd *arch, char *elt_name) bfd * _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos) { + static file_ptr prev_filepos; struct areltdata *new_areldata; bfd *n_nfd; char *filename; @@ -626,6 +625,12 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos) n_nfd = _bfd_look_for_bfd_in_cache (archive, filepos); if (n_nfd) return n_nfd; + /* PR15140: Prevent an inifnite recursion scanning a malformed nested archive . */ + if (filepos == prev_filepos) + { + bfd_set_error (bfd_error_malformed_archive); + return NULL; + } if (0 > bfd_seek (archive, filepos, SEEK_SET)) return NULL; @@ -634,6 +639,7 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos) return NULL; filename = new_areldata->filename; + prev_filepos = filepos; if (bfd_is_thin_archive (archive)) { fails to match any target after the first one. For cris, the targets are: a.out-cris elf32-us-cris elf32-cris ieee elf32-little elf32-big srec symbolsrec verilog tekhex binary ihex For x86-64, targets are elf64-x86-64 elf32-i386 elf32-x86-64 a.out-i386-linux pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils