Trying to define color 256 causes temporary hang #5209

Closed
opened 2026-01-31 00:07:34 +00:00 by claunia · 3 comments
Owner

Originally created by @egmontkob on GitHub (Nov 26, 2019).

Environment

Windows build number: 10.0.18362.0
Windows Terminal version: 0.7.3291.0

Steps to reproduce

Trying to redefine the exact RGB value for color index 256:

echo -ne '\e]4;256;rgb:ab/cd/ef\e\\'

Expected behavior

Nothing, because the index is out of range.

Actual behavior

The next shell prompt and the command as I type it doesn't appear. It takes a newline or so to get out of this state.

Note: This issue only occurs with exactly 256. With bigger numbers there's no hang.

Originally created by @egmontkob on GitHub (Nov 26, 2019). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: 10.0.18362.0 Windows Terminal version: 0.7.3291.0 ``` # Steps to reproduce Trying to redefine the exact RGB value for color index 256: echo -ne '\e]4;256;rgb:ab/cd/ef\e\\' # Expected behavior Nothing, because the index is out of range. # Actual behavior The next shell prompt and the command as I type it doesn't appear. It takes a newline or so to get out of this state. Note: This issue only occurs with exactly 256. With bigger numbers there's no hang.
Author
Owner

@j4james commented on GitHub (Nov 27, 2019):

Note that this is not a conhost issue - it only fails in Windows Terminal. The exact source of the error is in the Terminal::SetColorTableEntry method:

99a8337185/src/cascadia/TerminalCore/TerminalApi.cpp (L401-L405)

That test should be >=. It might even be safer to drop the test and rely on the at checking, but just make sure the exception is handled properly. Because even if we fix this particular test, it doesn't seem right that an exception would cause the parser to get into such a weird state.

@j4james commented on GitHub (Nov 27, 2019): Note that this is not a conhost issue - it only fails in Windows Terminal. The exact source of the error is in the `Terminal::SetColorTableEntry` method: https://github.com/microsoft/terminal/blob/99a833718525214aeb8846ec8a88b5551b80df21/src/cascadia/TerminalCore/TerminalApi.cpp#L401-L405 That test should be `>=`. It might even be safer to drop the test and rely on the `at` checking, but just make sure the exception is handled properly. Because even if we fix this particular test, it doesn't seem right that an exception would cause the parser to get into such a weird state.
Author
Owner

@zadjii-msft commented on GitHub (Nov 27, 2019):

Ooh, good catch. Thanks for finding that @j4james!

@zadjii-msft commented on GitHub (Nov 27, 2019): Ooh, good catch. Thanks for finding that @j4james!
Author
Owner

@ghost commented on GitHub (Jan 14, 2020):

:tada:This issue was addressed in #3938, which has now been successfully released as Windows Terminal Preview v0.8.10091.0.🎉

Handy links:

@ghost commented on GitHub (Jan 14, 2020): :tada:This issue was addressed in #3938, which has now been successfully released as `Windows Terminal Preview v0.8.10091.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v0.8.10091.0) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5209