-
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
More conhost exceptions via SetConsoleScreenBufferSize #8453
Labels
Area-Server
Down in the muck of API call servicing, interprocess communication, eventing, etc.
Issue-Bug
It either shouldn't be doing this or needs an investigation.
Product-Conhost
For issues in the Console codebase
Resolution-Fix-Committed
Fix is checked in, but it might be 3-4 weeks until a release.
Severity-Crash
Crashes are real bad news.
Milestone
Comments
ghost
added
Needs-Triage
It's a new issue that the core contributor team needs to triage at the next triage meeting
Needs-Tag-Fix
Doesn't match tag requirements
labels
Dec 1, 2020
Yea that seems sensible to me. Thanks for investigating and putting the fix together! |
zadjii-msft
added
Issue-Bug
It either shouldn't be doing this or needs an investigation.
Product-Conhost
For issues in the Console codebase
Severity-Crash
Crashes are real bad news.
labels
Dec 2, 2020
DHowett
added
Area-Server
Down in the muck of API call servicing, interprocess communication, eventing, etc.
and removed
Needs-Triage
It's a new issue that the core contributor team needs to triage at the next triage meeting
labels
Dec 3, 2020
ghost
pushed a commit
that referenced
this issue
Dec 3, 2020
When resizing the buffer in the `SetConsoleScreenBufferSize` and `SetConsoleScreenBufferInfoEx` APIs, we have tests in place to make sure that the resize doesn't result in the viewport extending past the bottom or right of the buffer (since that can eventually result in exceptions being thrown). Unfortunately these tests were using the wrong X coordinate, so they failed to detect an overflow along the horizontal axis. This PR corrects that mistake. PR #8309 was where the overflow detection was initially added. The original code was using the `Viewport::EndExclusive` method to determine the extent of the viewport, mistakenly thinking that it returned the bottom right coordinates (it actually returns the left coordinate). So I've now added a `BottomRightExclusive` method to the `Viewport` class, that actually does return the coordinates we need, and have updated the overflow tests to use that method instead. ## Validation Steps Performed I've manually confirmed that the test case is issue #8453 is no longer throwing an exception. Closes #8453
ghost
added
the
Resolution-Fix-Committed
Fix is checked in, but it might be 3-4 weeks until a release.
label
Dec 3, 2020
DHowett
pushed a commit
that referenced
this issue
Jan 25, 2021
When resizing the buffer in the `SetConsoleScreenBufferSize` and `SetConsoleScreenBufferInfoEx` APIs, we have tests in place to make sure that the resize doesn't result in the viewport extending past the bottom or right of the buffer (since that can eventually result in exceptions being thrown). Unfortunately these tests were using the wrong X coordinate, so they failed to detect an overflow along the horizontal axis. This PR corrects that mistake. PR #8309 was where the overflow detection was initially added. The original code was using the `Viewport::EndExclusive` method to determine the extent of the viewport, mistakenly thinking that it returned the bottom right coordinates (it actually returns the left coordinate). So I've now added a `BottomRightExclusive` method to the `Viewport` class, that actually does return the coordinates we need, and have updated the overflow tests to use that method instead. ## Validation Steps Performed I've manually confirmed that the test case is issue #8453 is no longer throwing an exception. Closes #8453 (cherry picked from commit 2a2f6b3)
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area-Server
Down in the muck of API call servicing, interprocess communication, eventing, etc.
Issue-Bug
It either shouldn't be doing this or needs an investigation.
Product-Conhost
For issues in the Console codebase
Resolution-Fix-Committed
Fix is checked in, but it might be 3-4 weeks until a release.
Severity-Crash
Crashes are real bad news.
Environment
Windows build number: Version 10.0.18363.1198
Windows Terminal version (if applicable): Commit 6213172
Steps to reproduce
Expected behavior
The conhost instance shouldn't crash and there shouldn't be any exceptions logged in the debug output.
Actual behavior
On my current version of Windows the conhost instance crashes. On the latest version of OpenConsole the exception is caught, so it at least doesn't crash, but you can see the error being logged in the debug output.
This is essentially the same bug as #1976, only the overflow is horizontal rather than vertical. It should have been fixed by PR #8309, but I managed to screw that up. I mistakenly thought the
Viewport::EndExclusive
method returned the bottom right extent of the viewport, but it's actually returning{ Left(), BottomExclusive() }
, so the overflow calculation doesn't detect a horizontal overflow. See here:terminal/src/host/getset.cpp
Lines 530 to 531 in d09fdd6
and here:
terminal/src/types/viewport.cpp
Lines 148 to 151 in ae550e0
The fix is easy enough. I'd probably just add something like an
ExclusiveExtent
method to theViewport
class that returns the range I was actually excepting to get fromViewport::EndExclusive
. Does that seem reasonable?The text was updated successfully, but these errors were encountered: