Skip to content

Fix LSP panic on out-of-bounds float values - #10859

Open
JRI98 wants to merge 1 commit into
roc-lang:mainfrom
JRI98:fix-10856
Open

Fix LSP panic on out-of-bounds float values#10859
JRI98 wants to merge 1 commit into
roc-lang:mainfrom
JRI98:fix-10856

Conversation

@JRI98

@JRI98 JRI98 commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Document synchronization notification handlers panicked when converting floating-point versions or range positions that were non-finite or exceeded destination integer limits.

This was addressed by validating floating-point inputs against integer boundaries before converting them, safely falling back to default values or rejecting invalid ranges, and lowered invalid client notification logs to warnings.

Fixes #10856

@greptile-apps

greptile-apps Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR prevents LSP document synchronization handlers from panicking when versions or range positions contain non-finite or out-of-bounds floating-point values.

  • Validates floating-point versions before converting them to i64.
  • Safely rejects invalid integer and floating-point range coordinates.
  • Downgrades recoverable invalid-client-notification logs to warnings.
  • Adds handler tests for out-of-bounds and valid floating-point inputs.

Confidence Score: 5/5

The PR appears safe to merge, with the changed conversion paths preventing the reported panics without introducing a concrete regression.

Invalid or out-of-range numeric inputs are now checked before integer conversion, valid inputs retain their prior behavior, and no blocking or independently actionable non-blocking issue remains.

Important Files Changed

Filename Overview
src/lsp/handlers/did_change.zig Adds finite-value and integer-bound checks for versions and range indices while treating invalid client changes as warning-level failures; no changed-code defect identified.
src/lsp/handlers/did_open.zig Guards float-to-i64 version conversion and falls back safely for invalid values; no changed-code defect identified.
src/lsp/test/handler_unit_tests.zig Adds regression coverage ensuring out-of-bounds float inputs do not panic and valid integral floats remain accepted.

Reviews (1): Last reviewed commit: "Fix LSP panic on out-of-bounds float val..." | Re-trigger Greptile

@JRI98
JRI98 enabled auto-merge August 19, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LSP panic: integer part of floating point value out of bounds

1 participant