[Bug binutils/18570] New: Crash in objdump (elf-attrs.c)

2015-06-22 Thread paulwebsec at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=18570

Bug ID: 18570
   Summary: Crash in objdump (elf-attrs.c)
   Product: binutils
   Version: 2.25
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: paulwebsec at gmail dot com
  Target Milestone: ---

Created attachment 8381
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8381&action=edit
file to reproduce the segfault

Segfault produced by the command: `objdump -r `

(gdb) r -r
"/home/user/binutils-gdb/afl_out_objdump/crashes/id:07,sig:11,src:002710,op:flip1,pos:26769"
Starting program: /home/user/binutils-gdb/binutils/objdump -r
"/home/user/binutils-gdb/afl_out_objdump/crashes/id:07,sig:11,src:002710,op:flip1,pos:26769"

Program received signal SIGSEGV, Segmentation fault.
0x006eba4c in bfd_elf_add_obj_attr_int (abfd=abfd@entry=0xc9b1c0,
vendor=vendor@entry=1, tag=tag@entry=-157895616, i=401923) at elf-attrs.c:300
300   attr->i = i;
(gdb) info registers
rax0x1  1
rbx0x0  0
rcx0x62203  401923
rdx0xf696b440   4137071680
rsi0x1  1
rdi0xc9b1c0 13218240
rbp0x6a34ff10   0x6a34ff10
rsp0x7fffe100   0x7fffe100
r8 0xc9f201 13234689
r9 0xf696b440   -157895616
r100x9  9
r110x3  3
r120x1  1
r130xc9b1c0 13218240
r140x62203  401923
r150xc9f29c 13234844
rip0x6eba4c 0x6eba4c 
eflags 0x10213  [ CF AF IF RF ]
cs 0x33 51
ss 0x2b 43
ds 0x0  0
es 0x0  0
fs 0x0  0
gs 0x0  0
(gdb) bt
#0  0x006eba4c in bfd_elf_add_obj_attr_int (abfd=abfd@entry=0xc9b1c0,
vendor=vendor@entry=1, tag=tag@entry=-157895616, i=401923) at elf-attrs.c:300
#1  0x006ee1c7 in _bfd_elf_parse_attributes (abfd=abfd@entry=0xc9b1c0,
hdr=hdr@entry=0xc9d8a0) at elf-attrs.c:539
#2  0x006335d5 in bfd_section_from_shdr (abfd=abfd@entry=0xc9b1c0,
shindex=shindex@entry=5) at elf.c:2119
#3  0x0061b4d0 in bfd_elf64_object_p (abfd=0xc9b1c0) at elfcode.h:800
#4  0x005af7c0 in bfd_check_format_matches (abfd=abfd@entry=0xc9b1c0,
format=format@entry=bfd_object, matching=matching@entry=0x7fffe490) at
format.c:305
#5  0x0041fdb0 in display_object_bfd (abfd=0xc9b1c0) at
./objdump.c:3407
#6  display_any_bfd (file=file@entry=0xc9b1c0, level=level@entry=0) at
./objdump.c:3498
#7  0x0040d1f6 in display_file (target=0x0, 
filename=0x7fffe861
"/home/user/binutils-gdb/afl_out_objdump/crashes/id:07,sig:11,src:002710,op:flip1,pos:26769")
at ./objdump.c:3519
#8  display_file (target=, 
filename=0x7fffe861
"/home/user/binutils-gdb/afl_out_objdump/crashes/id:07,sig:11,src:002710,op:flip1,pos:26769")
at ./objdump.c:3525
#9  main (argc=3, argv=0x7fffe618) at ./objdump.c:3802
(gdb)

-- 
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/18570] Crash in objdump (elf-attrs.c)

2015-06-22 Thread paulwebsec at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=18570

--- Comment #1 from PaulSec  ---
Tested on a Debian GNU/Linux 7 (wheezy) x86_64 GNU/Linux

-- 
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/18573] New: windres: resources alignment does not work.

2015-06-22 Thread sashipa.ben at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=18573

Bug ID: 18573
   Summary: windres: resources alignment does not work.
   Product: binutils
   Version: 2.25
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: sashipa.ben at gmail dot com
  Target Milestone: ---

Created attachment 8382
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8382&action=edit
Sample code to illustrate windres resource alignment problem

Hello,

I've just noticed this problem with windres (gave me a bit of a hardtime to
understand the problem).

The resource compiled with windres are not aligned.

Despite this https://sourceware.org/bugzilla/show_bug.cgi?id=16065 

I'm not sure what this code does. But it does not seem to align the resources.
This would not be a big problem if it did not break some resources. For
instance dialogs with combo box control that are not 32-bit aligned won't open
properly (possibly some other controls). It's tricky enough as it does not
generate any kind of error. Windows will just send a premature WM_DESTROY
before the WM_INITDIALOG.

I had a quick look at the source code. The easiest way to fix the problem seems
to force the alignment in the binutils/resbin.c:res_to_bin() function. I've
tried that and it worked but I did not watch the whole code in depth so I'm not
sure it has any unexpected side effect.

I've attached a little program to demonstrate the problem.

Best regards,
G.B

-- 
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/18573] windres: resources alignment does not work.

2015-06-22 Thread sashipa.ben at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=18573

Benjamin Gerard  changed:

   What|Removed |Added

 CC||sashipa.ben at gmail dot com

-- 
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 gas/18574] New: gas/config/tc-msp430.c: 9 * Redundant condition

2015-06-22 Thread dcb314 at hotmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=18574

Bug ID: 18574
   Summary: gas/config/tc-msp430.c: 9 * Redundant condition
   Product: binutils
   Version: 2.26 (HEAD)
Status: NEW
  Severity: minor
  Priority: P2
 Component: gas
  Assignee: unassigned at sourceware dot org
  Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

1.

[binutils-gdb/gas/config/tc-msp430.c:2072]: (style) Redundant condition:
!op1.reg. 'A && (!A || B)' is equivalent to 'A || B'

Source code is

  else if (op1.reg || (op1.reg == 0 && op1.am == 3))/* Not PC relative.  */

Maybe better code

  else if (op1.reg || op1.am == 3)/* Not PC relative.  */

Same thing at lines 2158, 2204, 2274, 2802, 2848, 2950, 2981

Also

gas/config/tc-msp430.c:3326]: (style) Redundant condition: fixp.fx_addsy. 'A &&
(!A || B)' is equivalent to 'A || B'

Source code is

 if (!fixp->fx_addsy || (fixp->fx_addsy
  && S_GET_SEGMENT (fixp->fx_addsy) == absolute_section))

-- 
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/18573] windres: resources alignment does not work.

2015-06-22 Thread sashipa.ben at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=18573

--- Comment #1 from Benjamin Gerard  ---
Created attachment 8383
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8383&action=edit
Fix windres resource alignment issue.

Patch to force a resource length to a multiple of 4 when it's converted to
binary thus aligning subsequent resources to 32 bit.

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