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

When win32 is resizing the viewport, make sure Right > Left #7768

Merged
merged 1 commit into from
Sep 28, 2020

Conversation

DHowett
Copy link
Member

@DHowett DHowett commented Sep 28, 2020

Sometimes when we were sliding the viewport to fit inside the buffer, we
would end up with left > right.

That would cause us to crash down the line when rendering.

Fixes MSFT:28387423.
Fixes #7744.

Validation

Manual run through 100% repro test case.

Sometimes when we were sliding the viewport to fit inside the buffer, we
would end up with left > right.

That would cause us to crash down the line when rendering.

Fixes #7744.

(cherry picked from commit 3687fa1cac78d88d32accd53f25f05466dcea1f9)
@ghost ghost added Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-0 Bugs that we consider release-blocking/recall-class (P0) Product-Conhost For issues in the Console codebase Severity-Crash Crashes are real bad news. labels Sep 28, 2020
@DHowett DHowett changed the title When resizing the viewport, make sure that right > left When win32 is resizing the viewport, make sure that right > left Sep 28, 2020
@DHowett DHowett added the Needs-Second It's a PR that needs another sign-off label Sep 28, 2020
// from having a negative width later.
srNewViewport.Right -= offRightDelta;
srNewViewport.Left = std::max<SHORT>(0, srNewViewport.Left - offRightDelta);
}
srNewViewport.Bottom = std::min(srNewViewport.Bottom, gsl::narrow<SHORT>(coordScreenBufferSize.Y - 1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to do the same thing down here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not pressingly. No hits on crashes because of negative height. The reason this is crashing is til::manage_vector is being given a huge size (negative size w/ 2's complement representation) when allocating preallocated storage for the buffer width.

@DHowett DHowett changed the title When win32 is resizing the viewport, make sure that right > left When win32 is resizing the viewport, make sure Right > Left Sep 28, 2020
@DHowett DHowett merged commit c3b3f5f into master Sep 28, 2020
@DHowett DHowett deleted the dev/duhowett/negging branch September 28, 2020 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Second It's a PR that needs another sign-off Priority-0 Bugs that we consider release-blocking/recall-class (P0) Product-Conhost For issues in the Console codebase Severity-Crash Crashes are real bad news.
Projects
None yet
3 participants