Bug 12720 - [regression] ar d segfaults
: [regression] ar d segfaults
Status: RESOLVED FIXED
Product: binutils
Classification: Unclassified
Component: binutils
: 2.22
: P2 normal
: ---
Assigned To: Alan Modra
:
:
:
:
  Show dependency treegraph
 
Reported: 2011-05-01 15:46 UTC by Matthias Klose
Modified: 2011-05-02 12:47 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2011-05-01 15:46:29 UTC
ar d libtcl8.5.a tclAppInit.o
segfaults.

caused by:

+++ b/binutils/ChangeLog
@@ -2,6 +2,8 @@

        * strings.c (print_strings): Plug memory leak.
        * ar.c (move_members): Plug memory leak.
+       (delete_members): Plug memory leak.
+       (write_archive): Plug memory leak.

reverting the change avoids the segfault.

(gdb) bt
#0  0x00007ffff739a165 in raise (sig=<value optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff739cf70 in abort () at abort.c:92
#2  0x00007ffff73d9ae0 in malloc_printerr (action=2, str=0x7ffff748df15
"free(): invalid pointer", ptr=0x3d61) at malloc.c:6272
#3  0x0000000000402e13 in delete_members (argc=4, argv=0x60e070) at
../../binutils/ar.c:1145
#4  main (argc=4, argv=0x60e070) at ../../binutils/ar.c:742
(gdb) up
#1  0x00007ffff739cf70 in abort () at abort.c:92
92      abort.c: No such file or directory.
        in abort.c
(gdb) up
#2  0x00007ffff73d9ae0 in malloc_printerr (action=2, str=0x7ffff748df15
"free(): invalid pointer", ptr=0x3d61) at malloc.c:6272
6272    malloc.c: No such file or directory.
        in malloc.c
(gdb) up
#3  0x0000000000402e13 in delete_members (argc=4, argv=0x60e070) at
../../binutils/ar.c:1145
1145                free ((char *) tmp);
(gdb) p tmp
Comment 1 cvs-commit@gcc.gnu.org 2011-05-02 06:04:14 UTC
CVSROOT:    /cvs/src
Module name:    src
Changes by:    amodra@sourceware.org    2011-05-02 06:04:11

Modified files:
    binutils       : ChangeLog ar.c 

Log message:
    PR binutils/12720
    Revert the following change
    Michael Snyder  <msnyder@vmware.com>
    * ar.c (move_members): Plug memory leak.
    (delete_members): Plug memory leak.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.1792&r2=1.1793
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/ar.c.diff?cvsroot=src&r1=1.76&r2=1.77
Comment 2 Alan Modra 2011-05-02 06:14:04 UTC
problem patch reverted.
Comment 3 cvs-commit@gcc.gnu.org 2011-05-02 12:47:50 UTC
CVSROOT:    /cvs/src
Module name:    src
Changes by:    hjl@sourceware.org    2011-05-02 12:47:47

Modified files:
    binutils/testsuite: ChangeLog 
    binutils/testsuite/binutils-all: ar.exp 

Log message:
    Add testcases for "ar -d" and "ar -m".

    2011-05-02  H.J. Lu  <hongjiu.lu@intel.com>

    PR binutils/12720
    * binutils-all/ar.exp (delete_an_element): New.
    (move_an_element): Likewise.
    Run delete_an_element and move_an_element.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/testsuite/ChangeLog.diff?cvsroot=src&r1=1.234&r2=1.235
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/testsuite/binutils-all/ar.exp.diff?cvsroot=src&r1=1.15&r2=1.16