Crash when resizing openconsole to 0 rows (was: std::clamping the cursor, 2023 edition) #19199

Open
opened 2026-01-31 06:36:38 +00:00 by claunia · 0 comments
Owner

Originally created by @zadjii-msft on GitHub (Jan 11, 2023).

@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:

4d27a05318/src/terminal/adapter/adaptDispatch.cpp (L219)

And I double checked with the commit from when PR #13001 was merged (79904361b3), 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. CLS) while the window had a zero size in order to trigger the crash.

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.

Originally posted by @j4james in https://github.com/microsoft/terminal/issues/12917#issuecomment-1378073019

Originally created by @zadjii-msft on GitHub (Jan 11, 2023). > @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: > > https://github.com/microsoft/terminal/blob/4d27a05318f4e86b0918497ba6f980968725a1d2/src/terminal/adapter/adaptDispatch.cpp#L219 > > And I double checked with the commit from when PR #13001 was merged (79904361b345b68f4612d41b390c4eb3f3d18fae), 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. `CLS`) while the window had a zero size in order to trigger the crash. > > 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. > _Originally posted by @j4james in https://github.com/microsoft/terminal/issues/12917#issuecomment-1378073019_
claunia added the Help WantedProduct-ConhostArea-OutputIssue-BugSeverity-Crash labels 2026-01-31 06:36:39 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19199