http://sourceware.org/bugzilla/show_bug.cgi?id=14567

             Bug #: 14567
           Summary: bfd_openr_next_archived_file is incompatible with
                    bfd_openr_iovec
           Product: binutils
           Version: 2.22
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
        AssignedTo: unassig...@sourceware.org
        ReportedBy: arseny.kapoulk...@gmail.com
    Classification: Unclassified


Attempting to open an archive file using bfd_openr_iovec and to subsequently
analyze the first archive member as follows:

bfd* parent = bfd_openr_iovec(path, 0, iovecOpen, &p, iovecRead, iovecClose,
iovecStat);

if (bfd_check_format(parent, bfd_archive))
{
        bfd* abfd = bfd_openr_next_archived_file(parent, NULL);
        if (!abfd) return 0;

        bfd_check_format(abfd, bfd_object);
...
}

results in a crash in opncls_bseek, that occurs because iostream member of the
child archive is NULL. _bfd_new_bfd_contained_in does not copy the iostream
member from the parent; adding the relevant assignment to this function fixes
the crash:

*** opncls.c    2012-09-09 20:59:30.489801700 -0700
--- opnclsnew.c 2012-09-09 20:59:16.483000600 -0700
***************
*** 119,124 ****
--- 119,125 ----
      return NULL;
    nbfd->xvec = obfd->xvec;
    nbfd->iovec = obfd->iovec;
+   nbfd->iostream = obfd->iostream;
    nbfd->my_archive = obfd;
    nbfd->direction = read_direction;
    nbfd->target_defaulted = obfd->target_defaulted;

-- 
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

Reply via email to