bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/25447] New: objcopy : free() invalid pointer in _bfd_coff_


From: fdgkhdkgh at gmail dot com
Subject: [Bug binutils/25447] New: objcopy : free() invalid pointer in _bfd_coff_free_symbols
Date: Thu, 23 Jan 2020 03:59:08 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=25447

            Bug ID: 25447
           Summary: objcopy : free() invalid pointer in
                    _bfd_coff_free_symbols
           Product: binutils
           Version: 2.35 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: fdgkhdkgh at gmail dot com
  Target Milestone: ---

Created attachment 12227
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12227&action=edit
file that reproduces this problem

Corrupted file can trigger the Floating point exception.


binutils Version : HEAD
git clone git://sourceware.org/git/binutils-gdb.git

OS : ubuntu 18.04.3
kernel : gnu/linux 5.0.0-32-generic
processor : Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
compiler : gcc 7.4.0


Steps to Reproduce :
download the sample from attachment

objcopy ./sample

gdb backtrace : 

#0  __GI_raise (sig=sig@entry=0x6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff7820801 in __GI_abort () at abort.c:79
#2  0x00007ffff7869897 in __libc_message (action=action@entry=do_abort, 
    fmt=fmt@entry=0x7ffff7996b9a "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3  0x00007ffff787090a in malloc_printerr (str=str@entry=0x7ffff7994d88
"free(): invalid pointer")
    at malloc.c:5350
#4  0x00007ffff7877e1c in _int_free (have_lock=0x0, p=0x5555558aed20,
av=0x7ffff7bcbc40 <main_arena>)
    at malloc.c:4157
#5  __GI___libc_free (mem=0x5555558aed30) at malloc.c:3124
#6  0x00005555556142c5 in _bfd_coff_free_symbols
(abfd=abfd@entry=0x5555558ab3c0) at coffgen.c:1782
#7  0x00005555556182ca in _bfd_coff_free_symbols (abfd=0x5555558ab3c0) at
coffgen.c:3179
#8  _bfd_coff_close_and_cleanup (abfd=0x5555558ab3c0) at coffgen.c:3180
#9  0x00005555555aadcb in bfd_close_all_done (abfd=0x5555558ab3c0) at
opncls.c:789
#10 0x000055555558e218 in copy_file (input_filename=0x7fffffff2a35 "./sample", 
    output_filename=0x7fffffff2a3e "./gg", input_target=<optimized out>, 
    output_target=<optimized out>, input_arch=0x0) at objcopy.c:3812
#11 0x0000555555588200 in copy_main (argv=<optimized out>, argc=<optimized
out>) at objcopy.c:5848
#12 main (argc=<optimized out>, argc@entry=0x3, argv=<optimized out>,
argv@entry=0x7fffffff2758)
    at objcopy.c:5974
#13 0x00007ffff7801b97 in __libc_start_main (main=0x5555555865b0 <main>,
argc=0x3, 
    argv=0x7fffffff2758, init=<optimized out>, fini=<optimized out>,
rtld_fini=<optimized out>, 
    stack_end=0x7fffffff2748) at ../csu/libc-start.c:310
#14 0x00005555555890aa in _start ()


--------


gdb peda report

[----------------------------------registers-----------------------------------]
RAX: 0x0 
RBX: 0x7fffffff2250 --> 0x5555558ac680 --> 0x5555558ac6a0 --> 0x0 
RCX: 0x7ffff781ee97 (<__GI_raise+199>:  mov    rcx,QWORD PTR [rsp+0x108])
RDX: 0x0 
RSI: 0x7fffffff1fe0 --> 0x0 
RDI: 0x2 
RBP: 0x7fffffff2350 --> 0xffffffffffffffb0 
RSP: 0x7fffffff1fe0 --> 0x0 
RIP: 0x7ffff781ee97 (<__GI_raise+199>:  mov    rcx,QWORD PTR [rsp+0x108])
R8 : 0x0 
R9 : 0x7fffffff1fe0 --> 0x0 
R10: 0x8 
R11: 0x246 
R12: 0x7fffffff2250 --> 0x5555558ac680 --> 0x5555558ac6a0 --> 0x0 
R13: 0x1000 
R14: 0x0 
R15: 0x30 ('0')
EFLAGS: 0x246 (carry PARITY adjust ZERO sign trap INTERRUPT direction overflow)
[-------------------------------------code-------------------------------------]
   0x7ffff781ee8b <__GI_raise+187>:     mov    edi,0x2
   0x7ffff781ee90 <__GI_raise+192>:     mov    eax,0xe
   0x7ffff781ee95 <__GI_raise+197>:     syscall 
=> 0x7ffff781ee97 <__GI_raise+199>:     mov    rcx,QWORD PTR [rsp+0x108]
   0x7ffff781ee9f <__GI_raise+207>:     xor    rcx,QWORD PTR fs:0x28
   0x7ffff781eea8 <__GI_raise+216>:     mov    eax,r8d
   0x7ffff781eeab <__GI_raise+219>:     jne    0x7ffff781eecc <__GI_raise+252>
   0x7ffff781eead <__GI_raise+221>:     add    rsp,0x118
[------------------------------------stack-------------------------------------]
0000| 0x7fffffff1fe0 --> 0x0 
0008| 0x7fffffff1fe8 --> 0x290006b 
0016| 0x7fffffff1ff0 --> 0x1 
0024| 0x7fffffff1ff8 --> 0x3e8000081b4 
0032| 0x7fffffff2000 --> 0x3e8 
0040| 0x7fffffff2008 --> 0x0 
0048| 0x7fffffff2010 --> 0x0 
0056| 0x7fffffff2018 --> 0x1000 
[------------------------------------------------------------------------------]
Legend: code, data, rodata, value
Stopped reason: SIGABRT
__GI_raise (sig=sig@entry=0x6) at ../sysdeps/unix/sysv/linux/raise.c:51

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]