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

Fix unsoundness on invalid utf-8 inputs #21

Merged
merged 1 commit into from
Jun 7, 2021
Merged

Fix unsoundness on invalid utf-8 inputs #21

merged 1 commit into from
Jun 7, 2021

Conversation

lf-
Copy link
Contributor

@lf- lf- commented Jun 7, 2021

Previously, unchecked user input bytes were passed into
str::from_utf8_unchecked, which was unsound as it was within a safe
function. It's been revised to check the user input and fail if there's
invalid input.

For a file with fun contents of broken UTF-8 to test with, see https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt

Previously, unchecked user input bytes were passed into
`str::from_utf8_unchecked`, which is unsound as it was within a safe
function. It's been revised to check the user input and fail if there's
invalid input.
@mgattozzi mgattozzi merged commit bb661f2 into rust-lang:master Jun 7, 2021
@mgattozzi
Copy link
Contributor

Thanks! Must of missed it when reviewing other's prs

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.

2 participants