Certain sequences with default parameters can trigger a crash #15234
Labels
In-PR
This issue has a related PR
Issue-Bug
It either shouldn't be doing this or needs an investigation.
Needs-Triage
It's a new issue that the core contributor team needs to triage at the next triage meeting
Windows Terminal version
1.17.1023
Windows build number
10.0.19045.2728
Other Software
No response
Steps to reproduce
printf "\e[\$r"
Expected Behavior
That sequence executes the
DECCARA
control with all default parameters. That should have the effect of resetting the attributes of everything on the screen.Actual Behavior
The terminal hangs for a second, and then the tab closes (assumedly because the underlying conhost has crashed).
The problem arises when using the
VTParameters::subspan
method to access an offset beyond the end of the original span. Other than theDECCARA
sequence, this can also be triggered byDECRARA
andDECPS
. In the latter case, the whole terminal can crash rather than just the active tab. That may just be a matter of chance though.My suggested fix would be to change the
VTParameters::subspan
implementation here:terminal/src/terminal/adapter/DispatchTypes.hpp
Line 187 in 5ed3c76
to something like this:
That way an offset beyond the end of the source span would just produce an empty span (that's what I mistakenly assumed the
subspan
was already doing).The text was updated successfully, but these errors were encountered: