-
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
"invalid bounds arguments passed to std::clamp" when resizing window to zero height #12917
Comments
For my own reference, which commit are you building off of? I just wanna know how far back we'll have to service this fix 😅 |
I'm building recent |
uh, https://github.com/microsoft/terminal/releases/tag/v1.10.1933.0 is like, 10 months old... If this goes that far back, well, we're in some serious trouble edit: just guesses
|
The more I think about, the more I think that call to For the same reason, I don't think this bounds error is the end of the world either. In a release build, the clamp is just going to fail to do anything, but that's no worse than the off screen clamping. It's just invalidating an area of the screen that doesn't need redrawing. So while we definitely should be fixing this, I don't think you need to panic about backporting the fix, unless I'm missing something. |
Oh oh oh maybe this is why #12739 Maybe we're clamping the cursor, drawing it there, and then not invalidating it at the clamped place. Idk. Just a thought while fixing this. EDIT: I was wrong. that one still repros. |
Don't clamp here, it's unnecessary. See notes in #12917 (comment) Closes #12917
Don't clamp here, it's unnecessary. See notes in #12917 (comment) Closes #12917
@zadjii-msft I think we may want to reopen this issue. I was just testing PR #14661, which kind of reverts your fix for this, and I wanted to make sure I hadn't reintroduced the bug. What I discovered was that the issue was never fully resolved - while we don't get a clamp assertion in the cursor code, we now just get it somewhere else instead! For me it occurred here:
And I double checked with the commit from when PR #13001 was merged (7990436), and it was already failing then. It may not be obvious in some shells, but in a WSL bash shell it crashes straight away. In a cmd shell I had to type some command (e.g. It's not a major problem, since it only happens in a debug build, but if we think it needs fixing we should probably reopen this, or at least open another issue if you prefer that. As for how we fix it, I would have liked it if we could put a minimum size on the viewport, but I suspect that's not possible in conhost for legacy reasons. So failing that, a quick fix would be to replace the clamp calls with a min/max combo which won't assert. But my concern is that the VT architecture is kind of dependent on a non-zero screen size, so there's a fair chance this issue might just surface elsewhere at some point in the future. Maybe we just have to accept that. |
Thanks for the write up @j4james. I'm gonna just promote that to another thread to try and keep the history a bit cleaner. |
Windows Terminal version
1.12.10733.0
Windows build number
10.0.22000
Other Software
No response
Steps to reproduce
Launch OpenConsole.exe compiled in debug mode, drag bottom of the window to the very top.
Expected Behavior
No assertion
Actual Behavior
Assertion from from STL
"invalid bounds arguments passed to std::clamp"
on the linein
Viewport Viewport::Clamp
Call stack
Looks like it happens because
SCREEN_INFORMATION::_InternalSetViewportSize
increases viewport'sTop
insrNewViewport.Top -= DeltaY;
(DeltaY
is negative) line without any check to preventTop
becoming more thanBottom
which sadly can happen. Clamp cannot work whenTop
is more thanBottom
The text was updated successfully, but these errors were encountered: