[Bug ld/21274] New: ld segfaults linking PE DLL

2017-03-19 Thread kyrab at mail dot ru
https://sourceware.org/bugzilla/show_bug.cgi?id=21274

Bug ID: 21274
   Summary: ld segfaults linking PE DLL
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: critical
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: kyrab at mail dot ru
  Target Milestone: ---

Created attachment 9907
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9907&action=edit
patch

`ld` segfaults when linking C++ PE DLL.

The culprit is pretty much trivial: `pe_create_import_fixup` uses fixed-sized
buffer to create mangled names, but this buffer is too small (300 bytes) and is
easily overflowed by long mangled names.

Quick patch is attached. I bumped the size of the buffer to more sane 2048
bytes. Since `gcc` doesn't limit identifier length, a proper fix would be
slightly more involved, but I didn't bother with it, sorry.

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


[Bug ld/21274] ld segfaults linking PE DLL

2017-03-19 Thread kyrab at mail dot ru
https://sourceware.org/bugzilla/show_bug.cgi?id=21274

--- Comment #1 from awson  ---
Better wording:

`pe_create_import_fixup` uses fixed-sized buffer to create decorated names, but
this buffer is too small (300 bytes) and is easily overflowed by long mangled
names.

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


[Bug binutils/21266] Unstable qsort in bfd/elf64-ppc.c results in difference in ld's TLS opt 3 test on Windows

2017-03-19 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21266

Alan Modra  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-03-19
 CC||amodra at gmail dot com
   Assignee|unassigned at sourceware dot org   |amodra at gmail dot com
 Ever confirmed|0   |1

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


[Bug binutils/21266] Unstable qsort in bfd/elf64-ppc.c results in difference in ld's TLS opt 3 test on Windows

2017-03-19 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21266

--- Comment #2 from Alan Modra  ---
This one is easy to fix in elf64-ppc.c, because we are sorting an array of
pointers.  The value of the pointer can be the final key.

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


[Bug binutils/21266] Unstable qsort in bfd/elf64-ppc.c results in difference in ld's TLS opt 3 test on Windows

2017-03-19 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21266

--- Comment #3 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Alan Modra :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=aaed6f5be3a41a88cc13c744e88af78f5a42dd5b

commit aaed6f5be3a41a88cc13c744e88af78f5a42dd5b
Author: Alan Modra 
Date:   Mon Mar 20 08:25:50 2017 +1030

PR 21266, unstable qsort in bfd/elf64-ppc.c

PR 21266
* elf64-ppc.c (compare_symbols): Stabilize sort.

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


[Bug binutils/21266] Unstable qsort in bfd/elf64-ppc.c results in difference in ld's TLS opt 3 test on Windows

2017-03-19 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21266

Alan Modra  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |2.29

--- Comment #4 from Alan Modra  ---
Fixed.

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


[Bug ld/21274] ld segfaults linking PE DLL

2017-03-19 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21274

Alan Modra  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-03-20
 CC||amodra at gmail dot com
   Assignee|unassigned at sourceware dot org   |amodra at gmail dot com
 Ever confirmed|0   |1

--- Comment #2 from Alan Modra  ---
pe_find_data_imports and pep_find_data_imports have a similar (larger)
restriction on name length.  Let's fix all of them.

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