[PR #15235] Prevent crash when VTParameters::subspan is out of range #30525

Open
opened 2026-01-31 09:41:21 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/15235

State: closed
Merged: Yes


Summary of the Pull Request

There are certain escape sequences that use the VTParameters::subspan
method to access a subsection of the provided parameter list. When the
parameter list is empty, that subspan call can end up using an offset
that is out of range, which causes the terminal to crash. This PR stops
that from happening by clamping the offset so it's in range.

References and Relevant Issues

This bug effected the DECCARA and DECRARA operations introduced in
PR #14285, and the DECPS operation introduced in PR #13208.

Validation Steps Performed

I've manually confirmed that the sequences mentioned above are no longer
crashing when executed with an empty parameter list, and I've added a
little unit test that checks VTParameters::subspan method is returning
the expected results when passed an offset that is out of range.

PR Checklist

**Original Pull Request:** https://github.com/microsoft/terminal/pull/15235 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request There are certain escape sequences that use the `VTParameters::subspan` method to access a subsection of the provided parameter list. When the parameter list is empty, that `subspan` call can end up using an offset that is out of range, which causes the terminal to crash. This PR stops that from happening by clamping the offset so it's in range. ## References and Relevant Issues This bug effected the `DECCARA` and `DECRARA` operations introduced in PR #14285, and the `DECPS` operation introduced in PR #13208. ## Validation Steps Performed I've manually confirmed that the sequences mentioned above are no longer crashing when executed with an empty parameter list, and I've added a little unit test that checks `VTParameters::subspan` method is returning the expected results when passed an offset that is out of range. ## PR Checklist - [x] Closes #15234 - [x] Tests added/passed - [ ] Documentation updated - [ ] Schema updated (if necessary)
claunia added the pull-request label 2026-01-31 09:41:21 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30525