Skip to content

Fix ICE from null character #17472

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

Merged
merged 2 commits into from
Sep 24, 2014
Merged

Fix ICE from null character #17472

merged 2 commits into from
Sep 24, 2014

Conversation

kaseyc
Copy link
Contributor

@kaseyc kaseyc commented Sep 23, 2014

Add checks for null bytes in the value strings for the export_name and link_section attributes, reporting an error if any are found, before calling with_c_str on them.

Fixes #16478

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (or someone else) soon.

@rust-highfive
Copy link
Contributor

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@@ -2670,6 +2670,15 @@ fn exported_name(ccx: &CrateContext, id: ast::NodeId,
}
}

fn contains_null(s: &str) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this just be replaced with .bytes().contains(0)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't look like the iterator implements any contains method. I did change it to use any() though.

Copy link
Member

Choose a reason for hiding this comment

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

@kaseyc It doesn't look like you pushed this revision to the PR. Once you do, I think it's ready to go!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I'm waiting for the change to finish a pass through make check, just to be thorough.

bors added a commit that referenced this pull request Sep 24, 2014
Add checks for null bytes in the value strings for the export_name and link_section attributes, reporting an error if any are found, before calling with_c_str on them.

Fixes #16478
@bors bors closed this Sep 24, 2014
@bors bors merged commit 3e8ad53 into rust-lang:master Sep 24, 2014
@kaseyc kaseyc deleted the ICE_fix branch September 24, 2014 20:56
lnicola pushed a commit to lnicola/rust that referenced this pull request Jul 28, 2024
rust-lang#17470 - run unit tests at the crate level not workspace

For rust-lang/rust-analyzer#17470

Use the test path to identify a package in the workspace and run the unit test there instead of at the workspace.
RalfJung pushed a commit to RalfJung/rust that referenced this pull request Aug 1, 2024
rust-lang#17470 - run unit tests at the crate level not workspace

For rust-lang/rust-analyzer#17470

Use the test path to identify a package in the workspace and run the unit test there instead of at the workspace.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE from c_str with null character
5 participants