Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle null from LLVMRustGetSectionName #62460

Merged
merged 2 commits into from
Jul 9, 2019
Merged

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Jul 7, 2019

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.

@rust-highfive
Copy link
Collaborator

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label 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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

@RalfJung RalfJung Jul 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@eddyb
Copy link
Member

eddyb commented Jul 9, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Jul 9, 2019

📌 Commit 076a5cd has been approved by eddyb

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 9, 2019
@bors
Copy link
Contributor

bors commented Jul 9, 2019

⌛ Testing commit 076a5cd with merge 8895384...

bors added a commit that referenced this pull request Jul 9, 2019
 Handle null from LLVMRustGetSectionName

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.
@bors
Copy link
Contributor

bors commented Jul 9, 2019

☀️ Test successful - checks-azure, checks-travis, status-appveyor
Approved by: eddyb
Pushing 8895384 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 9, 2019
@bors bors merged commit 076a5cd into rust-lang:master Jul 9, 2019
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #62460!

Tested on commit 8895384.
Direct link to PR: #62460

💔 rls on linux: test-pass → test-fail (cc @Xanewok, @rust-lang/infra).

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).
@RalfJung RalfJung deleted the llvm-null branch July 23, 2019 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants