[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/135] New: bfd crashes when processing nested archives.
From: |
mikulas at artax dot karlin dot mff dot cuni dot cz |
Subject: |
[Bug binutils/135] New: bfd crashes when processing nested archives. |
Date: |
27 Apr 2004 13:41:52 -0000 |
BFD 2.14 crashes when program is opening and operating on archives containing
other archives (with bfd_openr_next_archived_file).
The problems arise usually when there are too many open files and open file
caching takes effect.
At many places in code, there are constructs like
if (bfd->my_archive) offset += bfd->origin;
and similar.
The problem with these is that if bfd->my_archive is contained in some archive
too, you add only offset of inner archive, not offset of outer
archive. Similarly, in bfd_cache_lookup_worker you do
if (abfd->my_archive) abfd = abfd->my_archive; --- now if archives are nested,
you need to get to the topmost archive.
The crash becomes because of this and other bug --- bfd cache doesn't check if
files was reopened succesfully --- see my next bug report.
The attached patch fixes the problems with nested archives --- it modifies
archive creating so that bfd->my_archive always points to the topmost
archive, not to the immediate descendant. With the patch, i can link large
programs with nested archives flawlessly.
--- bfd/archive.c_ Wed Apr 21 19:28:07 2004
+++ bfd/archive.c Wed Apr 21 20:54:25 2004
@@ -498,6 +498,11 @@
struct areltdata *new_areldata;
bfd *n_nfd;
+ if (archive->my_archive) {
+ filepos += archive->origin;
+ archive = archive->my_archive;
+ }
+
n_nfd = _bfd_look_for_bfd_in_cache (archive, filepos);
if (n_nfd)
return n_nfd;
@@ -593,6 +598,7 @@
BSD-4.4-style element with a long odd size. */
filestart = last_file->origin + size;
filestart += filestart % 2;
+ if (archive->my_archive) filestart -= archive->origin;
}
return _bfd_get_elt_at_filepos (archive, filestart);
--
Summary: bfd crashes when processing nested archives.
Product: binutils
Version: 2.14
Status: NEW
Severity: critical
Priority: P2
Component: binutils
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: mikulas at artax dot karlin dot mff dot cuni dot cz
CC: bug-binutils at gnu dot org
GCC build triplet: i586-pc-linux-gnu
GCC host triplet: i486-pc-spad
GCC target triplet: i486-pc-spad
http://sources.redhat.com/bugzilla/show_bug.cgi?id=135
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug binutils/135] New: bfd crashes when processing nested archives.,
mikulas at artax dot karlin dot mff dot cuni dot cz <=