https://sourceware.org/bugzilla/show_bug.cgi?id=25360
Bug ID: 25360 Summary: memory leak in readelf, get_data Product: binutils Version: 2.32 Status: UNCONFIRMED Severity: critical Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: featherrain26 at gmail dot com Target Milestone: --- Created attachment 12181 --> https://sourceware.org/bugzilla/attachment.cgi?id=12181&action=edit POC file Hi, there. There is a memory leak in file binutils/readelf.c, get_data function. Here is the reproducing environment and procedure: Distributor ID: Ubuntu Description: Ubuntu 16.04.6 LTS Release: 16.04 Codename: xenial gcc: 5.4.0 compilation: CFLAGS="-fsanitize=address,undefined" ./configure ./readelf -agteSdcWw --dyn-syms -D poc Here is the error message: ================================================================= ==15608==ERROR: LeakSanitizer: detected memory leaks Direct leak of 69 byte(s) in 1 object(s) allocated from: #0 0x7ffff6f02602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x40b2a1 in get_data (/playground/playground/binutils-2.32-r/binutils-2.32/binutils/readelf+0x40b2a1) #2 0x478a80 in process_notes_at (/playground/playground/binutils-2.32-r/binutils-2.32/binutils/readelf+0x478a80) #3 0x47961f in process_corefile_note_segments (/playground/playground/binutils-2.32-r/binutils-2.32/binutils/readelf+0x47961f) #4 0x47a0f6 in process_note_sections (/playground/playground/binutils-2.32-r/binutils-2.32/binutils/readelf+0x47a0f6) #5 0x47a195 in process_notes (/playground/playground/binutils-2.32-r/binutils-2.32/binutils/readelf+0x47a195) #6 0x47c930 in process_object (/playground/playground/binutils-2.32-r/binutils-2.32/binutils/readelf+0x47c930) #7 0x47e950 in process_file (/playground/playground/binutils-2.32-r/binutils-2.32/binutils/readelf+0x47e950) #8 0x47ecd1 in main (/playground/playground/binutils-2.32-r/binutils-2.32/binutils/readelf+0x47ecd1) #9 0x7ffff5db382f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) SUMMARY: AddressSanitizer: 69 byte(s) leaked in 1 allocation(s). Regards, -- You are receiving this mail because: You are on the CC list for the bug.