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

            Bug ID: 32716
           Summary: Memory leak issue in objdump
           Product: binutils
           Version: 2.44
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Dear developers,

We found a possible memory leakage issue in `objdump`, using a new symbolic
execution-based tool. We tested the `objdump` in both binutils-2.43 and 2.44,
and they behaved the same. Please check the following steps to reproduce.


Build command: `CC=gcc CFLAGS="-g -fsanitize=address" ../configure
--disable-nls --disable-largefile --disable-gdb --disable-sim
--disable-readline --disable-libdecnumber --disable-libquadmath
--disable-libstdcxx --disable-ld --disable-gprof --disable-gas --disable-intl
--disable-etc`

Environment: Ubuntu 18.04; GCC-7.5

The command for reproducing the memory leakage:

$./objdump -a -Zi -
BFD header file version (GNU Binutils) 2.44
elf64-x86-64
 (header little endian, data little endian)
  i386
elf32-i386
 (header little endian, data little endian)
  i386
elf32-iamcu
 (header little endian, data little endian)
  iamcu
elf32-x86-64
 (header little endian, data little endian)
  i386
pei-i386
 (header little endian, data little endian)
  i386
pe-x86-64
 (header little endian, data little endian)
  i386
pei-x86-64
 (header little endian, data little endian)
  i386
elf64-little
 (header little endian, data little endian)
  i386
  iamcu
elf64-big
 (header big endian, data big endian)
  i386
  iamcu
elf32-little
 (header little endian, data little endian)
  i386
  iamcu
elf32-big
 (header big endian, data big endian)
  i386
  iamcu
srec
 (header endianness unknown, data endianness unknown)
  i386
  iamcu
symbolsrec
 (header endianness unknown, data endianness unknown)
  i386
  iamcu
verilog
 (header endianness unknown, data endianness unknown)
  i386
  iamcu
tekhex
 (header endianness unknown, data endianness unknown)
  i386
  iamcu
binary
 (header endianness unknown, data endianness unknown)
  i386
  iamcu
ihex
 (header endianness unknown, data endianness unknown)
  i386
  iamcu
plugin
 (header little endian, data little endian)

         elf64-x86-64 elf32-i386 elf32-iamcu elf32-x86-64 pei-i386 pe-x86-64 
    i386 elf64-x86-64 elf32-i386 ----------- elf32-x86-64 pei-i386 pe-x86-64
   iamcu ------------ ---------- elf32-iamcu ------------ -------- ---------

         pei-x86-64 elf64-little elf64-big elf32-little elf32-big srec 
    i386 pei-x86-64 elf64-little elf64-big elf32-little elf32-big srec
   iamcu ---------- elf64-little elf64-big elf32-little elf32-big srec

         symbolsrec verilog tekhex binary ihex plugin 
    i386 symbolsrec verilog tekhex binary ihex ------
   iamcu symbolsrec verilog tekhex binary ihex ------

=================================================================
==11652==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 12288 byte(s) in 1 object(s) allocated from:
    #0 0x7ffff6ef6b40 in __interceptor_malloc
(/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x555555aa6139 in xrealloc ../../libiberty/xmalloc.c:179
    #2 0x55555573eb1e in do_display_target ../../binutils/bucomm.c:277
    #3 0x555555808cf4 in bfd_iterate_over_targets ../../bfd/targets.c:1772
    #4 0x55555573f1d4 in display_target_list ../../binutils/bucomm.c:327
    #5 0x55555573f81a in display_info ../../binutils/bucomm.c:434
    #6 0x5555556b2b68 in main ../../binutils/objdump.c:6356
    #7 0x7ffff6844c86 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 12288 byte(s) leaked in 1 allocation(s).

Since there is a large amount of memory leaked, this might be an important
issue? Please kindly check and let me know if you need anything else to
reproduce it.

Thanks,
Haoxin

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

Reply via email to