Skip to content

LSP malformed JSON can terminate the server loop #2829

Description

@Widthdom

Summary

LspServer.HandleMessage parses the payload before entering the try block that catches JsonException. A malformed JSON-RPC frame can therefore throw out of Run and terminate the LSP server loop instead of returning a JSON-RPC parse error or dropping the bad frame.

Evidence

  • src/CodeIndex/Lsp/LspServer.cs:29 calls HandleMessage(payload) without a surrounding catch.
  • src/CodeIndex/Lsp/LspServer.cs:39 runs JsonDocument.Parse(payload) before the later try block.
  • The catch at src/CodeIndex/Lsp/LspServer.cs:63 includes JsonException, but parse failures from line 39 never reach it.

Expected

Malformed JSON should be handled inside the LSP message loop and should not terminate the server process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions