bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/23165] New: Several Memory Leaks in chew of binutils


From: mudongliangabcd at gmail dot com
Subject: [Bug binutils/23165] New: Several Memory Leaks in chew of binutils
Date: Thu, 10 May 2018 23:13:05 +0000

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

            Bug ID: 23165
           Summary: Several Memory Leaks in chew of binutils
           Product: binutils
           Version: 2.31 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: mudongliangabcd at gmail dot com
  Target Milestone: ---

I found several memory leaks with Address Sanitizer or Valgrind.

Reproduction method:

```
git clone git://sourceware.org/git/binutils-gdb.git

mkdir obj_clang
CC=clang CFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address"
../configure
make
cd bfd/doc/
./chew -f < ../../../bfd/aoutx.h 

or

mkdir obj_native
../configure 
make
cd bfd/doc/
valgrind --leak-check=full  --show-leak-kinds=all ./chew -f <
../../../bfd/aoutx.h 
```

Result of Address Sanitizer:

```
$ ./chew -f < ../../../bfd/aoutx.h
Can't open the input file (null)

=================================================================
==21926==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 320000 byte(s) in 1 object(s) allocated from:
    #0 0x4d1cc5 in realloc
(/home/mdl/Downloads/binutils-gdb/obj_afl/bfd/doc/chew+0x4d1cc5)
    #1 0x5137db in catbuf
/home/mdl/Downloads/binutils-gdb/obj_afl/bfd/doc/../../../bfd/doc/chew.c:231:30
    #2 0x5128c9 in read_in
/home/mdl/Downloads/binutils-gdb/obj_afl/bfd/doc/../../../bfd/doc/chew.c:1505:7
    #3 0x50db66 in main
/home/mdl/Downloads/binutils-gdb/obj_afl/bfd/doc/../../../bfd/doc/chew.c:1582:3
    #4 0x7f573d8f1a86 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21a86)

Direct leak of 20000 byte(s) in 1 object(s) allocated from:
    #0 0x4d1cc5 in realloc
(/home/mdl/Downloads/binutils-gdb/obj_afl/bfd/doc/chew+0x4d1cc5)
    #1 0x51267f in catchar
/home/mdl/Downloads/binutils-gdb/obj_afl/bfd/doc/../../../bfd/doc/chew.c:204:30
    #2 0x512b55 in remove_noncomments
/home/mdl/Downloads/binutils-gdb/obj_afl/bfd/doc/../../../bfd/doc/chew.c:479:5
    #3 0x50dba4 in main
/home/mdl/Downloads/binutils-gdb/obj_afl/bfd/doc/../../../bfd/doc/chew.c:1583:3
    #4 0x7f573d8f1a86 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21a86)

Direct leak of 5000 byte(s) in 1 object(s) allocated from:
    #0 0x4d18a0 in malloc
(/home/mdl/Downloads/binutils-gdb/obj_afl/bfd/doc/chew+0x4d18a0)
    #1 0x513ac9 in init_string_with_size
/home/mdl/Downloads/binutils-gdb/obj_afl/bfd/doc/../../../bfd/doc/chew.c:131:26
    #2 0x50e269 in init_string
/home/mdl/Downloads/binutils-gdb/obj_afl/bfd/doc/../../../bfd/doc/chew.c:138:3
    #3 0x50dcfd in main
/home/mdl/Downloads/binutils-gdb/obj_afl/bfd/doc/../../../bfd/doc/chew.c:1592:8
    #4 0x7f573d8f1a86 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21a86)

SUMMARY: AddressSanitizer: 345000 byte(s) leaked in 3 allocation(s).
```

Result of Valgrind:

```
https://gist.github.com/mudongliang/03c97f7c39c19c6013c3bd5a549a2282
```

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