bug-binutils
[Top][All Lists]
Advanced

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

Bug 22065 - unique_segment_for_sections holds on to passed-in segment na


From: Julian Lettner
Subject: Bug 22065 - unique_segment_for_sections holds on to passed-in segment name
Date: Fri, 1 Sep 2017 18:47:40 -0700

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)
```


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

Attachment: binutils.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]