Summary
The LSP position-line loader checks file size before reading but can still materialize more than the configured cap if the file grows concurrently.
Integrated v1.39.4 findings
- LSP position-line loader can materialize a file that grows after the length check
Evidence
TryReadAllPositionLines checks FileStream.Length, calls StreamReader.ReadToEnd, and checks Position only afterward. A workspace file can grow beyond MaxPositionDocumentBytes during materialization.
Expected behavior / direction
Use a bounded streaming reader that stops before allocation crosses the cap, handles multibyte text safely, and returns a clear bounded diagnostic. Add a deterministic growth-during-read test.
Related closed issues
These issues remain closed; this is a new regression or follow-up observed on v1.39.4.
Environment
Reproduced with a locally built cdidx v1.39.4 from current origin/main at 87b8bf44210344f52ba4cb7827c149dfad32c0c8, using a fresh repository index on macOS arm64.
Summary
The LSP position-line loader checks file size before reading but can still materialize more than the configured cap if the file grows concurrently.
Integrated v1.39.4 findings
Evidence
TryReadAllPositionLineschecksFileStream.Length, callsStreamReader.ReadToEnd, and checksPositiononly afterward. A workspace file can grow beyondMaxPositionDocumentBytesduring materialization.Expected behavior / direction
Use a bounded streaming reader that stops before allocation crosses the cap, handles multibyte text safely, and returns a clear bounded diagnostic. Add a deterministic growth-during-read test.
Related closed issues
These issues remain closed; this is a new regression or follow-up observed on v1.39.4.
Environment
Reproduced with a locally built
cdidxv1.39.4 from currentorigin/mainat87b8bf44210344f52ba4cb7827c149dfad32c0c8, using a fresh repository index on macOS arm64.