Empty path to OSC 9;9; crashes Terminal window #16649

Closed
opened 2026-01-31 05:18:25 +00:00 by claunia · 7 comments
Owner

Originally created by @kstauffer on GitHub (Feb 4, 2022).

Windows Terminal version

1.13.10336.0

Windows build number

10.0.19042.1466

Other Software

No response

Steps to reproduce

In WSL bash, echo $'\e]9;9;\e\\'

Expected Behavior

Terminal should keep running. I don't know if the devs think an empty path should be treated as a no-op or like a well-formed path to a non-existent directory. For example, \e]9;9;/foo\e\\\ sets the directory to /.

Actual Behavior

Terminal window hangs immediately (tested by running date in a tight loop in the background) and crashes a second later.

Originally created by @kstauffer on GitHub (Feb 4, 2022). ### Windows Terminal version 1.13.10336.0 ### Windows build number 10.0.19042.1466 ### Other Software _No response_ ### Steps to reproduce In WSL bash, `echo $'\e]9;9;\e\\'` ### Expected Behavior Terminal should keep running. I don't know if the devs think an empty path should be treated as a no-op or like a well-formed path to a non-existent directory. For example, `\e]9;9;/foo\e\\\` sets the directory to /. ### Actual Behavior Terminal window hangs immediately (tested by running `date` in a tight loop in the background) and crashes a second later.
Author
Owner

@j4james commented on GitHub (Feb 6, 2022):

This was something I was planning to look at as a followup PR #12247. In the same way that AdaptDispatch and ConGetSet are designed to throw exceptions for error handling, the equivalent Terminal classes TerminalDispatch and ITerminalApi should be doing the same thing. That way exceptions like this would be caught in the StateMachine and recovered gracefully.

I had initially planned to leave this till I was further along refactoring the conhost side of things, but maybe it's a good idea to get it done sooner rather than later if it'll save users from having a crashed terminal. Any objections to that?

@j4james commented on GitHub (Feb 6, 2022): This was something I was planning to look at as a followup PR #12247. In the same way that `AdaptDispatch` and `ConGetSet` are designed to throw exceptions for error handling, the equivalent Terminal classes `TerminalDispatch` and `ITerminalApi` should be doing the same thing. That way exceptions like this would be caught in the `StateMachine` and recovered gracefully. I had initially planned to leave this till I was further along refactoring the conhost side of things, but maybe it's a good idea to get it done sooner rather than later if it'll save users from having a crashed terminal. Any objections to that?
Author
Owner

@j4james commented on GitHub (Feb 6, 2022):

I should add that this isn't necessarily a fix for the OSC 9;9 handling - I'm not sure what the correct behaviour is for that. I just want to make sure the terminal isn't needlessly crashing in situations like this.

@j4james commented on GitHub (Feb 6, 2022): I should add that this isn't necessarily a fix for the `OSC 9;9` handling - I'm not sure what the correct behaviour is for that. I just want to make sure the terminal isn't needlessly crashing in situations like this.
Author
Owner

@zadjii-msft commented on GitHub (Feb 7, 2022):

I agree. At the very least, we should fix this crash now, so we can service the fix to the in-market builds.

@zadjii-msft commented on GitHub (Feb 7, 2022): I agree. At the very least, we should fix this crash now, so we can service the fix to the in-market builds.
Author
Owner

@zadjii-msft commented on GitHub (Feb 10, 2022):

Hey @j4james should this be closed by #12432? Since the crashing doesn't happen anymore? I think right now we just ignore an empty path, which sure seems reasonable to me

@zadjii-msft commented on GitHub (Feb 10, 2022): Hey @j4james should this be closed by #12432? Since the crashing doesn't happen anymore? I think right now we just ignore an empty path, which sure seems reasonable to me
Author
Owner

@j4james commented on GitHub (Feb 10, 2022):

I'd prefer to keep it open. I'm not actually sure what the correct behaviour is meant to be - I haven't had a chance to check that in ConEmu. But even if ignoring the path is the right thing to do, I'd expect that to be handled as a deliberate condition in the path parser - not just something that happens coincidentally because of a buffer overflow.

@j4james commented on GitHub (Feb 10, 2022): I'd prefer to keep it open. I'm not actually sure what the correct behaviour is meant to be - I haven't had a chance to check that in ConEmu. But even if ignoring the path is the right thing to do, I'd expect that to be handled as a deliberate condition in the path parser - not just something that happens coincidentally because of a buffer overflow.
Author
Owner

@zadjii-msft commented on GitHub (Feb 10, 2022):

Fine by me ☺️ I am gonna move it out of the 1.14 milestone though, just for the sake of work tracking. The bug that needed immediate fixing is gone. We can double check the real behavior later. Thanks again!

@zadjii-msft commented on GitHub (Feb 10, 2022): Fine by me ☺️ I _am_ gonna move it out of the 1.14 milestone though, just for the sake of work tracking. The bug that needed immediate fixing is gone. We can double check the real behavior later. Thanks again!
Author
Owner

@j4james commented on GitHub (Feb 10, 2022):

I am gonna move it out of the 1.14 milestone though, just for the sake of work tracking.

Yeah, that makes perfect sense. I've just checked ConEmu now and it looks like a blank path is simply ignored, i.e. it retains the last valid path that was set. So what we have is technically correct - it's just a code health issue now.

@j4james commented on GitHub (Feb 10, 2022): > I am gonna move it out of the 1.14 milestone though, just for the sake of work tracking. Yeah, that makes perfect sense. I've just checked ConEmu now and it looks like a blank path is simply ignored, i.e. it retains the last valid path that was set. So what we have is technically correct - it's just a code health issue now.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16649