Fix panic on CSI sequences with more than 32 parameters #1009
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.35) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 177 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.310
Real PR Conversation Timeline
1 comments
"Review active on #1009"
general
weight: 0.35
DHowett
Csi::paramshas 32 slots, but each;in a CSI sequence incrementedCsi::param_countwithout a bound. A sequence with more than 32 parameters produced aCsiwhoseparam_countwas larger thanparams.len(), which panics in two places:parse_xterm_mouse(&csi.params[..csi.param_count], ..)ininput.rs(forESC <):range end index 41 out of range for slice of length 32the reset loop at the start of the next CSI sequence in
vt.rs:index out of bounds: the len is 32 but the index is 40Repro
Running
editin a pty (80x24,TERM=xterm-256color) and writingESC [ <followed by 40;andm, thenESC [ A, aborts the editor (exit status 6) with the second panic above, losing any unsaved changes. With this change the editor keeps running.Fix
Stop counting at
params.len(), both on;and on the final byte. That matches how the digits of excess parameters are already skipped: the first 32 parameters are kept and the rest are dropped.Tests
Added
vt::testswith two cases (40 numeric parameters followed by another sequence, and 40 empty parameters). Both fail onmainand pass with the fix.cargo +nightly fmt --all -- --check,cargo +nightly test --workspaceandcargo +nightly clippy --workspace --all-features --all-targets -- --no-deps --deny warningspass locally (macOS arm64).🤖 Generated with [Claude Code