-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Support valid out-of-bounds access in utextAccess #17361
Merged
Merged
Conversation
This file contains 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
lhecker
commented
Jun 4, 2024
auto neededIndex = nativeIndex; | ||
// This will make it simpler for us to search the row that contains the nativeIndex, | ||
// because we'll now only need to check for `start<=index<limit` and nothing else. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reduce your diff NOW by applying the patented whitespace-reduction to your browser: https://github.com/microsoft/terminal/pull/17361/files?w=1
Results may vary.
DHowett
approved these changes
Jun 4, 2024
carlos-zamora
approved these changes
Jun 5, 2024
ghost
approved these changes
Jun 5, 2024
DHowett
pushed a commit
that referenced
this pull request
Jun 7, 2024
`utextAccess` apparently doesn't actually need to clamp the `chunkOffset` to be in range of the current chunk. Also, I missed to implement the part of the spec that says to leave the iterator on the first/last chunk of the `UText` in case of an out-of-bounds index. This PR fixes the issue by simply not returning early, doing a more liberal clamp of the offset, and then checking whether it was in range. As an aside, this also fixes a one-off bug when hovering URLs that end on the very last cell of the viewport (or are cut off). Closes #17343 ## Validation Steps Performed * Write an URL that wraps across the last 2 lines in the buffer * Scroll 1 line up * No assert ✅ * Hovering the URL shows the full, still visible parts of the URL ✅ (cherry picked from commit 261a3fe) Service-Card-Id: 92678595 Service-Version: 1.20
DHowett
pushed a commit
that referenced
this pull request
Jun 7, 2024
`utextAccess` apparently doesn't actually need to clamp the `chunkOffset` to be in range of the current chunk. Also, I missed to implement the part of the spec that says to leave the iterator on the first/last chunk of the `UText` in case of an out-of-bounds index. This PR fixes the issue by simply not returning early, doing a more liberal clamp of the offset, and then checking whether it was in range. As an aside, this also fixes a one-off bug when hovering URLs that end on the very last cell of the viewport (or are cut off). Closes #17343 ## Validation Steps Performed * Write an URL that wraps across the last 2 lines in the buffer * Scroll 1 line up * No assert ✅ * Hovering the URL shows the full, still visible parts of the URL ✅ (cherry picked from commit 261a3fe) Service-Card-Id: 92678596 Service-Version: 1.21
lhecker
added
the
Issue-Bug
It either shouldn't be doing this or needs an investigation.
label
Nov 1, 2024
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.
utextAccess
apparently doesn't actually need to clamp thechunkOffset
to be in range of the current chunk. Also, I missed toimplement the part of the spec that says to leave the iterator on the
first/last chunk of the
UText
in case of an out-of-bounds index.This PR fixes the issue by simply not returning early, doing a more
liberal clamp of the offset, and then checking whether it was in range.
As an aside, this also fixes a one-off bug when hovering URLs that
end on the very last cell of the viewport (or are cut off).
Closes #17343
Validation Steps Performed