Bug 1323760

Summary: object-only code uses string after it has been freed
Product: Red Hat Developer Toolset Reporter: Nick Clifton <nickc>
Component: binutilsAssignee: Nick Clifton <nickc>
Status: CLOSED NOTABUG QA Contact: Martin Cermak <mcermak>
Severity: low Docs Contact:
Priority: unspecified    
Version: DTS 4.1 RHEL 6CC: kanderso, law, mcermak, mnewsome, mpolacek, ohudlick
Target Milestone: beta1   
Target Release: 4.1   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1323759 Environment:
Last Closed: 2016-04-06 09:38:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1323759    
Bug Blocks:    
Attachments:
Description Flags
Proposed Patch none

Description Nick Clifton 2016-04-04 15:44:38 UTC
Created attachment 1143381 [details]
Proposed Patch

+++ This bug was initially created as a clone of Bug #1323759 +++

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:38:34 UTC
This BZ has already been fixed by another commit.