Skip to content

lsp: validate range bounds in Locate to avoid panic on malformed LSP ranges#187

Open
SAY-5 wants to merge 1 commit intocloudwego:mainfrom
SAY-5:say5/lsp-locate-bounds-186
Open

lsp: validate range bounds in Locate to avoid panic on malformed LSP ranges#187
SAY-5 wants to merge 1 commit intocloudwego:mainfrom
SAY-5:say5/lsp-locate-bounds-186

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 2, 2026

Fixes #186.

LSPClient.Locate indexed f.LineCounts[range.Line] and sliced text[start:end] without validating the range. When pylsp (jedi/parso) returns a malformed range — e.g. [13:6] — abcoder hard-crashes during parse python. Validate line indices and the resulting offsets, returning an error so the collector can skip the token instead.

…ranges

Signed-off-by: SAY-5 <say.apm35@gmail.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

parse python panics in LSPClient.Locate (slice bounds out of range) when following imports into .venv

2 participants