[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gold/22065] New: unique_segment_for_sections holds on to passed-in
From: |
julian.lettner at gmail dot com |
Subject: |
[Bug gold/22065] New: unique_segment_for_sections holds on to passed-in segment name |
Date: |
Sat, 02 Sep 2017 01:35:29 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=22065
Bug ID: 22065
Summary: unique_segment_for_sections holds on to passed-in
segment name
Product: binutils
Version: 2.30 (HEAD)
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gold
Assignee: ccoutant at gmail dot com
Reporter: julian.lettner at gmail dot com
CC: ian at airs dot com
Target Milestone: ---
Created attachment 10386
--> https://sourceware.org/bugzilla/attachment.cgi?id=10386&action=edit
Patch
The function unique_segment_for_section (which is part of the public plugin
API) stores the passed in segment name pointer without creating a copy of the
string. This requires callers to make sure that the passed-in name has a
sufficiently long life time. This is not the expected behavior and puts more
burden on the caller (who needs to be aware this fact).
The attached patch (2 modified lines) changes the type of
`Unique_segment_info::name` from `const char*` to `std::string` to fix this
issue.
```
static enum ld_plugin_status
unique_segment_for_sections(const char* segment_name,
uint64_t flags,
uint64_t align,
const struct ld_plugin_section* section_list,
unsigned int num_sections)
```
--
You are receiving this mail because:
You are on the CC list for the bug.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug gold/22065] New: unique_segment_for_sections holds on to passed-in segment name,
julian.lettner at gmail dot com <=