bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/32505] New: Memory leak in objcopy when using --add-gnu-de


From: pengsy21 at m dot fudan.edu.cn
Subject: [Bug binutils/32505] New: Memory leak in objcopy when using --add-gnu-debuglink option.
Date: Sat, 28 Dec 2024 00:49:30 +0000

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

            Bug ID: 32505
           Summary: Memory leak in objcopy when using --add-gnu-debuglink
                    option.
           Product: binutils
           Version: 2.44 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: pengsy21 at m dot fudan.edu.cn
  Target Milestone: ---

Created attachment 15861
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15861&action=edit
A compressed tar file containing the objcopy binary affected by the bug and the
payload required to reproduce it.

A memory leak occurs in objcopy when it is executed with the
--add-gnu-debuglink option. The function bfd_fill_in_gnu_debuglink_section is
invoked in this scenario, and in its only return true branch, it fails to
release the contents memory object allocated within the function. This results
in memory not being properly freed.

Steps to reproduce:
Build an objcopy binary with AddressSanitizer (ASAN) enabled, or use the
pre-built binary attached.
Run the following command:
ASAN_OPTIONS=detect_leaks=1,fast_unwind_on_malloc=0 ./objcopy
--add-gnu-debuglink payload.bin payload.bin

LeakSanitizer will report a memory leak, indicating the location of the unfreed
memory allocation. The function identified will correspond to the issue
described.

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