Skip to content

Fix infinite loop#63581

Open
core-dumpling wants to merge 1 commit into
microsoft:mainfrom
core-dumpling:fix-infinite-loop
Open

Fix infinite loop#63581
core-dumpling wants to merge 1 commit into
microsoft:mainfrom
core-dumpling:fix-infinite-loop

Conversation

@core-dumpling

Copy link
Copy Markdown

Fixes #63580

Copilot AI review requested due to automatic review settings June 24, 2026 09:06
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Jun 24, 2026
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Jun 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a parser/scanner hang triggered by certain JSDoc comment contents ending in -*/ (e.g. /**a-*/), by fixing operator-precedence in the identifier scanning loop so the pos < end guard correctly applies to both identifier-part scanning and the special - allowance.

Changes:

  • Fixes the while condition in scanJsDocToken so char === CharacterCodes.minus can’t keep the loop running after pos has reached end.

Comment thread src/compiler/scanner.ts
if (isIdentifierStart(ch, languageVersion)) {
let char = ch;
while (pos < end && isIdentifierPart(char = codePointUnchecked(pos), languageVersion) || char === CharacterCodes.minus) pos += charSize(char);
while (pos < end && (isIdentifierPart(char = codePointUnchecked(pos), languageVersion) || char === CharacterCodes.minus)) pos += charSize(char);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, this needs a testcase

@RyanCavanaugh RyanCavanaugh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test. Thanks!

@github-project-automation github-project-automation Bot moved this from Not started to Waiting on author in PR Backlog Jun 24, 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

Status: Waiting on author

Development

Successfully merging this pull request may close these issues.

Parser hangs on comment ending with -*/

3 participants