fix(osc): guard params[1] access in OSC 1337 arm against missing second param#12872
fix(osc): guard params[1] access in OSC 1337 arm against missing second param#12872adhavan18 wants to merge 1 commit into
Conversation
…nd param (warpdotdev#12817) a bare 'ESC ] 1337 BEL' (no second parameter) caused an index-out-of-bounds panic because the 1337 arm accessed params[1] unconditionally. every neighboring OSC arm (133, 777, 52, 9277, 9278...) already checks params.len() before accessing params[1]. the 1337 arm was the only exception. fix: add a params.len() < 2 early-return to unhandled() at the top of the 1337 arm, exactly mirroring the pattern used by all surrounding arms. adds a regression test: parsing 'ESC ] 1337 BEL' must not panic.
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @adhavan18 on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment |
|
Every PR must be linked to a same-repo issue before Oz can review it. This PR is linked to #12817, but no linked issue is marked See the contribution guidelines for the full readiness model. Powered by Oz |
There was a problem hiding this comment.
Every PR must be linked to a same-repo issue before Oz can review it.
This PR is linked to #12817, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.
See the contribution guidelines for the full readiness model.
Powered by Oz
Description
adds a
params.len() < 2guard at the top of theb"1337"arm inosc_dispatchso a parameterless OSC 1337 sequence is treated as unhandled instead of panicking.Linked Issue
ready-to-specorready-to-implement.fixes #12817
Root cause
app/src/terminal/model/ansi/mod.rs,osc_dispatch, theb"1337"arm directly accessesparams[1]without a length guard. every neighboring OSC arm (133,777,52,9277,9278) checksparams.len()before accessing any param beyond index 0 — the 1337 arm was the only exception.when the sequence has no second parameter (
params == [b"1337"]),params[1]is out of bounds → panic.Fix
three lines added at the top of the
b"1337"arm:this is identical to the guard pattern already used by
b"133",b"777",b"52", and others.Testing
./script/runadded a regression unit test in
mod_tests.rs:manual test:
printf '\e]1337\a'in a running warp session no longer crashes.Agent Mode
CHANGELOG-BUG-FIX: fix panic when receiving a bare OSC 1337 sequence without a second parameter