Bug 1323759 - object-only code uses string after it has been freed
Summary: object-only code uses string after it has been freed
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Developer Toolset
Classification: Red Hat
Component: binutils
Version: DTS 4.1 RHEL 7
Hardware: All
OS: All
unspecified
low
Target Milestone: beta1
: 4.1
Assignee: Nick Clifton
QA Contact: Martin Cermak
URL:
Whiteboard:
Depends On:
Blocks: 1323760
TreeView+ depends on / blocked
 
Reported: 2016-04-04 15:43 UTC by Nick Clifton
Modified: 2016-04-06 09:37 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1323760 (view as bug list)
Environment:
Last Closed: 2016-04-06 09:37:54 UTC
Target Upstream Version:


Attachments (Terms of Use)
Proposed patch (1.03 KB, patch)
2016-04-04 15:43 UTC, Nick Clifton
no flags Details | Diff

Description Nick Clifton 2016-04-04 15:43:24 UTC
Created attachment 1143380 [details]
Proposed patch

Description of problem:

The function ld/ldlang.c:cmdline_add_object_only_section() assigns the variable
ofilename to the result of bfd_get_filename(), but it does not copy the result.
Thus once bfd_close has been called on the file, ofilename no longer points to
valid memory.  But, it is still used by cmdline_add_object_only_section as an
argument to rename().


Version-Release number of selected component (if applicable):

n/a.

How reproducible:

Run linker testsuite.  Note failures of LTO 5 and LTO 3 tests.

Additional info:

Comment 2 Nick Clifton 2016-04-06 09:37:54 UTC
This BZ has already been fixed by another commit.


Note You need to log in before you can comment on or make changes to this bug.