-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
AtlasEngine: Fix a heap overflow bug #14275
Conversation
{ | ||
_api.invalidatedRows.x = 0; | ||
_api.invalidatedRows.y = gsl::narrow_cast<u16>(clamp<int>(_api.invalidatedRows.y + delta, u16min, u16max)); | ||
} | ||
} |
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.
This change is way less egregious if you suppress whitespace changes.
This block of changes is unrelated to this PR but represent an earlier attempt at fixing it. I left it in because it'll help with implementing horizontal scrolling in the future.
gsl::narrow_cast<u16>(srNewViewport.Right - srNewViewport.Left + 1), | ||
gsl::narrow_cast<u16>(srNewViewport.Bottom - srNewViewport.Top + 1), | ||
gsl::narrow_cast<u16>(std::max(1, srNewViewport.Right - srNewViewport.Left + 1)), | ||
gsl::narrow_cast<u16>(std::max(1, srNewViewport.Bottom - srNewViewport.Top + 1)), |
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.
Prevents an orderly/expected crash when you resize the conhost window down to 0px height.
std::fill_n(_api.bufferLineMetadata.data() + x, column - x, metadata); | ||
} | ||
|
||
_api.lastPaintBufferLineCoord = { x, y }; | ||
_api.bufferLineWasHyperlinked = false; |
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.
This block moved down since I'm computing x
late now.
} | ||
|
||
auto column = x; | ||
clusters = clusters.subspan(offset); | ||
} |
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.
The fix.
// into the first column. Since other code then blindly assumes that there's a | ||
// preceding `Leading` character, we'll get called with a X coordinate of -1. | ||
// | ||
// This block can be removed after GH#13626 is merged. |
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.
we will never remember this
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.
Eh, we don't really have to. This is a small, self-contained snippet and so I feel like it can be removed whenever. But I'll add a note to make this change in my ROW PR.
`TextBuffer` is buggy and allows a `Trailing` `DbcsAttribute` to be written into the first column. Since other code then blindly assumes that there's a preceding `Leading` character, we'll get called with a X coordinate of -1. This issue will be fixed by #13626 and this commit fixes it in the meantime. Additionally fixes an unimportant crash when the window height is 0px, because it was annoying during testing and doesn't hurt to be fixed. ## Validation Steps Performed * Run a stress test that prints random Unicode at random positions * Resize the window furiously at the same time * Doesn't crash / fail-fast ✅ (cherry picked from commit bb4711d) Service-Card-Id: 86353783 Service-Version: 1.16
🎉 Handy links: |
TextBuffer
is buggy and allows aTrailing
DbcsAttribute
to be writteninto the first column. Since other code then blindly assumes that there's a
preceding
Leading
character, we'll get called with a X coordinate of -1.This issue will be fixed by #13626 and this commit fixes it in the meantime.
Additionally fixes an unimportant crash when the window height is 0px,
because it was annoying during testing and doesn't hurt to be fixed.
Validation Steps Performed