Handle null from LLVMRustGetSectionName #62460
Merged
bors merged 2 commits intorust-lang:masterfrom Jul 9, 2019
Merged
Conversation
Contributor
|
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
nikic
reviewed
Jul 7, 2019
| let name_len = llvm::LLVMRustGetSectionName(si.llsi, &mut name_buf); | ||
| let name = slice::from_raw_parts(name_buf as *const u8, name_len as usize).to_vec(); | ||
| let name = String::from_utf8(name).unwrap(); | ||
| let name = name_buf.map_or( |
Contributor
There was a problem hiding this comment.
For the purposes of this code, sections without name can be skipped entirely. I'm also wondering why this code is creating a String rather than a str, it does not seem necessary.
Member
Author
There was a problem hiding this comment.
Are you saying I should change something? I literally have no idea what the code here is doing, I'm afraid. @nitnelave just did the minimal thing to avoid NULL references.
Member
|
@bors r+ |
Collaborator
|
📌 Commit 076a5cd has been approved by |
Collaborator
Collaborator
|
☀️ Test successful - checks-azure, checks-travis, status-appveyor |
Contributor
rust-highfive
added a commit
to rust-lang-nursery/rust-toolstate
that referenced
this pull request
Jul 9, 2019
Tested on commit rust-lang/rust@8895384. Direct link to PR: <rust-lang/rust#62460> 💔 rls on linux: test-pass → test-fail (cc @Xanewok, @rust-lang/infra).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As part of #58783 and #62103, this incorrect use of a NULL pointer was found in the interface to LLVM. That PR is stuck with some linker issues, but there is no reason the soundness fix should have to wait for that.