fix: prevent panic when reporting line overflow with hard_tabs (6442) - #7009
Open
willbuckner wants to merge 1 commit into
Open
fix: prevent panic when reporting line overflow with hard_tabs (6442)#7009willbuckner wants to merge 1 commit into
hard_tabs (6442)#7009willbuckner wants to merge 1 commit into
Conversation
The `LineOverflow` struct stores line widths in visual columns (a tab counts as `tab_spaces`), but the error report was using them as byte offsets into the line buffer when building the annotation. When an overflowing line was indented with hard tabs, the range overran the end of the buffer, and `annotate-snippets` panicked. Instead, compute the annotation range in bytes from the line buffer. This also fixes misplaced annotations on overflowing lines containing multi-byte characters.
Contributor
|
This is meant to fix #6442? If so, can you update the PR description with |
Author
Yes, sorry about that, added! I was too focused on the rest of my commit message and forgot to tag the issue :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
LineOverflowstruct stores line widths in visual columns (a tab counts astab_spaces), but the error report was using them as byte offsets into the line buffer when building the annotation. When an overflowing line was indented with hard tabs, the range overran the end of the buffer, andannotate-snippetspanicked.Instead, compute the annotation range in bytes from the line buffer. This also fixes misplaced annotations on overflowing lines containing multi-byte characters.
Fixes: #6442