Skip to content

fix: Fix panic in progress due to splitting unicode incorrectly #19490

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

Conversation

rossdylan
Copy link
Contributor

In the rare occasion that someone has added unicode characters that are multiple code points, the previous slicing operation could incorrectly split that character, and panic. The fix is to use the chars() iterator and just skip the prefix.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 1, 2025
@rossdylan
Copy link
Contributor Author

I can add a reproduction / test case tomorrow morning.

Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

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

This code is currently quadratic (unrelated to your change), it could use a perf improvement, but it isn't hot so I guess this is fine.

Thanks!

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Apr 1, 2025
Merged via the queue into rust-lang:master with commit 082ebaa Apr 1, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants