Skip to content

Prevent infinite loop in unstable AST JSDoc scanner - #64141

Draft
Jake Bailey (jakebailey) with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-scanjsdoctoken-infinite-loop
Draft

Prevent infinite loop in unstable AST JSDoc scanner#64141
Jake Bailey (jakebailey) with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-scanjsdoctoken-infinite-loop

Conversation

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

The unstable AST JSDoc scanner could loop indefinitely when a scan range ended immediately after -, because the range check did not guard the full identifier condition.

Changes

  • Guard both identifier parts and hyphens with pos < end:
while (pos < end && (isIdentifierPart(...) || char === CharacterCodes.minus))
  • Add regression coverage verifying that a range ending in x- reaches EOF and preserves the expected tokens.

Copilot AI and others added 2 commits September 3, 2026 01:00
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix infinite loop in scanJsDocToken for unstable/ast Prevent infinite loop in unstable AST JSDoc scanner Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unstable/ast: scanJsDocToken infinite-loops when a scan range ends on a trailing '-' (fix from #63581 not carried into the AST scanner)

2 participants