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 panic when comparing ropes with chunks that do not align at char bounds #65

Merged
merged 1 commit into from
Nov 1, 2022

Conversation

pascalkuthe
Copy link
Collaborator

During the development of helix-editor/helix#3890, @xJonathanLEI provided a test case that would cause a panic in ropey.

It turns out that PartialEq for RopeSlice indexes into a str using byte indices that might not be char bounds.
The fix for this issue was to simply operate on byte slices directly.
The very similar PartialOrd implementation has received the same treatment in the past but PartialEq seems to have been overlooked.

src/slice.rs Outdated Show resolved Hide resolved
@cessen
Copy link
Owner

cessen commented Nov 1, 2022

Awesome! Thanks for catching this.

@cessen cessen merged commit bdcad27 into cessen:master Nov 1, 2022
@pascalkuthe pascalkuthe deleted the non_ascii_comparison branch November 1, 2022 15:41
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.

3 participants