[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/23952] New: A memory leak issue was discovered in bfd
From: |
wcventure at 126 dot com |
Subject: |
[Bug binutils/23952] New: A memory leak issue was discovered in bfd |
Date: |
Wed, 05 Dec 2018 00:44:02 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=23952
Bug ID: 23952
Summary: A memory leak issue was discovered in bfd
Product: binutils
Version: 2.31
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: wcventure at 126 dot com
Target Milestone: ---
Created attachment 11430
--> https://sourceware.org/bugzilla/attachment.cgi?id=11430&action=edit
MemoryLeak-POC
Hi there,
A memory leak issue was discovered in bfd, as distributed in GNU Binutils 2.31.
In _bfd_generic_read_minisymbols function in syms.c, the is a heap allocation.
But this heap allocation didn't deallocate in the end. The source Code show as
follow.
> 809 if (storage < 0)
> 810 goto error_return;
> 811 if (storage == 0)
> 812 return 0;
> 813
> 814 syms = (asymbol **) bfd_malloc (storage);
> 815 if (syms == NULL)
> 816 goto error_return;
> 817
> 818 if (dynamic)
Please use the "./nm -C $POC" to reproduce the bug.
To reproduce this bug. You need to build bintuils-2.31 with ASAN, setting
following Command:
> export ASAN_OPTIONS=abort_on_error=1:symbolize=1:detect_leaks=1
The Leak Sanitizer dumps the stack trace as follows:
> ==31800==ERROR: LeakSanitizer: detected memory leaks
>
> Direct leak of 8 byte(s) in 1 object(s) allocated from:
> #0 0x7fd48c209b90 in __interceptor_malloc
> (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb90)
> #1 0x4298a3 in bfd_malloc
> /home/wencheng/Documents/Experiment/binutils-2.31_ASAN/bfd/libbfd.c:271
> #2 0x433e68 in _bfd_generic_read_minisymbols
> /home/wencheng/Documents/Experiment/binutils-2.31_ASAN/bfd/syms.c:814
> #3 0x4078d5 in display_rel_file
> /home/wencheng/Documents/Experiment/binutils-2.31_ASAN/binutils/nm.c:1113
> #4 0x408b40 in display_file
> /home/wencheng/Documents/Experiment/binutils-2.31_ASAN/binutils/nm.c:1325
> #5 0x40a737 in main
> /home/wencheng/Documents/Experiment/binutils-2.31_ASAN/binutils/nm.c:1799
> #6 0x7fd48bb7d82f in __libc_start_main
> (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
>
> SUMMARY: AddressSanitizer: 8 byte(s) leaked in 1 allocation(s).
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug binutils/23952] New: A memory leak issue was discovered in bfd,
wcventure at 126 dot com <=