Bug 25372 - Memory leak in /src/binutils-gdb/bfd/libbfd.c:275:9
Summary: Memory leak in /src/binutils-gdb/bfd/libbfd.c:275:9
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.34
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2020-01-11 15:13 UTC by Skyvast
Modified: 2020-01-13 09:38 UTC (History)
1 user (show)

See Also:
Last reconfirmed:

Compile binutils with ASAN, and read this file as input. (72 bytes, application/octet-stream)
2020-01-11 15:13 UTC, Skyvast

Note You need to log in before you can comment on or make changes to this bug.
Description Skyvast 2020-01-11 15:13:35 UTC
Created attachment 12186 [details]
Compile binutils with ASAN, and read this file as input.

ASAN report:
==29467==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 4224 byte(s) in 1 object(s) allocated from:
    #0 0x521ffd in malloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3
    #1 0x5592b7 in bfd_malloc /src/binutils-gdb/bfd/libbfd.c:275:9
    #2 0x554d7c in bfd_check_format_matches /src/binutils-gdb/bfd/format.c:242:47
    #3 0x5547fd in LLVMFuzzerTestOneInput /src/binutils-gdb/fuzz/fuzz_bfd.c:49:5
    #4 0x45a461 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:556:15
    #5 0x444f81 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:292:6
    #6 0x44ac3e in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:774:9
    #7 0x474b62 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:19:10
    #8 0x7f051ca8582f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

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

INFO: a leak has been found in the initial corpus.

INFO: to ignore leaks on libFuzzer side use -detect_leaks=0.

root@b8ff83db9427:/out# ./fuzz_bfd leak-fd5d9b8ba6dc786baf81293dbe23736ae7c579b4 
INFO: Seed: 2632369351
INFO: Loaded 1 modules   (145987 inline 8-bit counters): 145987 [0x1acc8b0, 0x1af02f3), 
INFO: Loaded 1 PC tables (145987 PCs): 145987 [0x13e5d38,0x1620168), 
./fuzz_bfd: Running 1 inputs 1 time(s) each.
Running: leak-fd5d9b8ba6dc786baf81293dbe23736ae7c579b4
Comment 1 Alan Modra 2020-01-13 09:38:32 UTC
I suspect this leak may have been fixed 2019-12-20.  Current sources show no leak on the testcase.