[Bug admin/10785] New: memory access violation in bfd/opncls.c

View: New views
7 Messages — Rating Filter:   Alert me  

[Bug admin/10785] New: memory access violation in bfd/opncls.c

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I get a memory access violation when running a 64-bit debug build of binutils
current nm on x86_64 Interix. Like this:
nm-new /usr/lib/somelib

The shell print some lines and then become unresponsive

shell: Interix 64bit ksh (pdksh)
Compiler: Interix cc frontend of MS x64 compiler 15.00.30729.01

Running a 32bit Interix gcc 3.3 nm binary build will exit silently at same spot

The offending line is:
bfd/opncls.c(712): free (bim->buffer);
in this code block
-----------------------------------------------------------------------------  
if ((abfd->flags & BFD_IN_MEMORY) != 0)
    {
      /* FIXME: cagney/2004-02-15: Need to implement a BFD_IN_MEMORY io
         vector.
         Until that's done, at least don't leak memory.  */
      struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream;
      free (bim->buffer);
      free (bim);
      ret = TRUE;
    }
  else
    ret = abfd->iovec->bclose (abfd);

-----------------------------------------------------------------------------

Note that free should work even if there are no memory allocated

--
           Summary: memory access violation in bfd/opncls.c
           Product: binutils
           Version: 2.21 (HEAD)
            Status: NEW
          Severity: critical
          Priority: P2
         Component: admin
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: jerker dot back at gmail dot com
                CC: bug-binutils at gnu dot org
 GCC build triplet: x86_64-unknown-interix6.1
  GCC host triplet: x86_64-unknown-interix6.1
GCC target triplet: x86_64-unknown-interix6.1


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug admin/10785] memory access violation in bfd/opncls.c

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From amodra at bigpond dot net dot au  2009-10-16 05:34 -------
We have some dodgy memory allocation in peicode.h

--
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at sources dot   |amodra at bigpond dot net
                   |redhat dot com              |dot au
             Status|NEW                         |ASSIGNED
   Last reconfirmed|0000-00-00 00:00:00         |2009-10-16 05:34:14
               date|                            |


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug admin/10785] memory access violation in bfd/opncls.c

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From amodra at bigpond dot net dot au  2009-10-16 07:10 -------
Well, peicode.h alloc was OK until
http://sourceware.org/ml/binutils/2009-07/msg00255.html came along :-(

--


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug admin/10785] memory access violation in bfd/opncls.c

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2009-10-16 07:15 -------
Subject: Bug 10785

CVSROOT: /cvs/src
Module name: src
Changes by: amodra@... 2009-10-16 07:14:44

Modified files:
        bfd            : ChangeLog opncls.c coff-alpha.c peicode.h

Log message:
        PR binutils/10785
        * coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Don't bfd_alloc
        bim and bim->buffer.  bfd_malloc instead.
        * peicode.h (pe_ILF_build_a_bfd): Similarly.
        (ILF_DATA_SIZE): Don't include bim.
        * opncls.c (bfd_close): Test bim->buffer non-NULL before freeing.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.4815&r2=1.4816
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/opncls.c.diff?cvsroot=src&r1=1.58&r2=1.59
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/coff-alpha.c.diff?cvsroot=src&r1=1.40&r2=1.41
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/peicode.h.diff?cvsroot=src&r1=1.60&r2=1.61



--


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug binutils/10785] memory access violation in bfd/opncls.c

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From amodra at bigpond dot net dot au  2009-10-16 07:51 -------
Fixed

--
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
          Component|admin                       |binutils
         Resolution|                            |FIXED


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug binutils/10785] memory access violation in bfd/opncls.c

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2009-10-16 10:03 -------
Subject: Bug 10785

CVSROOT: /cvs/src
Module name: src
Branch: binutils-2_20-branch
Changes by: gingold@... 2009-10-16 10:02:44

Modified files:
        bfd            : ChangeLog coff-alpha.c opncls.c peicode.h

Log message:
        2009-10-16  Alan Modra  <amodra@...>
       
        PR binutils/10785
        * coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Don't bfd_alloc
        bim and bim->buffer.  bfd_malloc instead.
        * peicode.h (pe_ILF_build_a_bfd): Similarly.
        (ILF_DATA_SIZE): Don't include bim.
        * opncls.c (bfd_close): Test bim->buffer non-NULL before freeing.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_20-branch&r1=1.4761.2.25&r2=1.4761.2.26
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/coff-alpha.c.diff?cvsroot=src&only_with_tag=binutils-2_20-branch&r1=1.40&r2=1.40.6.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/opncls.c.diff?cvsroot=src&only_with_tag=binutils-2_20-branch&r1=1.57.2.1&r2=1.57.2.2
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/peicode.h.diff?cvsroot=src&only_with_tag=binutils-2_20-branch&r1=1.59.2.1&r2=1.59.2.2



--


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug binutils/10785] memory access violation in bfd/opncls.c

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From jerker dot back at gmail dot com  2009-10-16 20:29 -------
Problem gone in both 64bit and 32bit builds
Thanks

--


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils