Unsupported CSI, OSC or DEC private mode parsing is interrupted on a delay #4295

Closed
opened 2026-01-30 23:43:17 +00:00 by claunia · 3 comments
Owner

Originally created by @egmontkob on GitHub (Oct 5, 2019).

Environment

Windows build number: Win32NT 10.0.18362.0
Windows Terminal version (if applicable): 0.5.2762.0

Steps to reproduce

Sibling issue of #3080. Execute this:

echo -ne '\e[?12'; sleep 1; echo -ne '34h'

Expected behavior

As if the delay wasn't there, this should attempt to enable DEC private mode 1234, which is unsupported by WT (actually undefined), so no action should be taken.

Actual behavior

34h is printed, suggesting that parsing the sequence got interrupted.

Note that if the given number is supported (e.g. 1049 to switch to the alternate screen) then the sequence is parsed and executed correctly even when a delay is injected.


Update:

The same goes for unsupported CSI modes too, e.g. \e[22;0;0t (save title on stack) or \e[4l (replace mode).

Originally created by @egmontkob on GitHub (Oct 5, 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: Win32NT 10.0.18362.0 Windows Terminal version (if applicable): 0.5.2762.0 ``` # Steps to reproduce Sibling issue of #3080. Execute this: echo -ne '\e[?12'; sleep 1; echo -ne '34h' # Expected behavior As if the delay wasn't there, this should attempt to enable DEC private mode 1234, which is unsupported by WT (actually undefined), so no action should be taken. # Actual behavior `34h` is printed, suggesting that parsing the sequence got interrupted. Note that if the given number is supported (e.g. 1049 to switch to the alternate screen) then the sequence is parsed and executed correctly even when a delay is injected. --- Update: The same goes for unsupported CSI modes too, e.g. `\e[22;0;0t` (save title on stack) or `\e[4l` (replace mode).
Author
Owner

@DHowett-MSFT commented on GitHub (Oct 8, 2019):

Oh, this is interesting. We only flush the unknown/unparseable string that completed the sequence! That'll be the root cause for the sibling bug as well.

Thanks!

@DHowett-MSFT commented on GitHub (Oct 8, 2019): Oh, this is interesting. We only flush the unknown/unparseable string that completed the sequence! That'll be the root cause for the sibling bug as well. Thanks!
Author
Owner

@DHowett-MSFT commented on GitHub (Oct 8, 2019):

(We successfully identify that we're dealing with \e[?1234h, but by the time we get the h we've lost the beginning as you've rightly surmised.)

@DHowett-MSFT commented on GitHub (Oct 8, 2019): (We successfully identify that we're dealing with `\e[?1234h`, but by the time we get the `h` we've lost the beginning as you've rightly surmised.)
Author
Owner

@egmontkob commented on GitHub (Jan 30, 2020):

Explicit hyperlinks (not yet supported: #204) are also affected in the same way (tested in 0.8.10091.0).

Test with:

cat hyperlink-demo.txt

The longer the target URL, the more likely the corruption occurs, but it is easily reproducible with short URLs too by injecting a delay.

This is likely to cause actual problems, since there's no way to detect (or advertise) hyperlink support, most of the apps just assume that the terminal at least silently ignores the sequence. See e.g. the recent discussion under the hyperlink spec.

@egmontkob commented on GitHub (Jan 30, 2020): Explicit hyperlinks (not yet supported: #204) are also affected in the same way (tested in 0.8.10091.0). Test with: cat [hyperlink-demo.txt](https://gitlab.gnome.org/GNOME/vte/raw/0.58.3/perf/hyperlink-demo.txt) The longer the target URL, the more likely the corruption occurs, but it is easily reproducible with short URLs too by injecting a delay. This is likely to cause actual problems, since there's no way to detect (or advertise) hyperlink support, most of the apps just assume that the terminal at least silently ignores the sequence. See e.g. the [recent discussion](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#gistcomment-3158325) under the hyperlink spec.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#4295