Skip to content

Fix infinite loop#63581

Merged
RyanCavanaugh merged 4 commits into
microsoft:mainfrom
core-dumpling:fix-infinite-loop
Jun 25, 2026
Merged

Fix infinite loop#63581
RyanCavanaugh merged 4 commits into
microsoft:mainfrom
core-dumpling:fix-infinite-loop

Conversation

@core-dumpling

Copy link
Copy Markdown
Contributor

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
@core-dumpling

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@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.

Failing lint

@github-project-automation github-project-automation Bot moved this from Waiting on author to Needs merge in PR Backlog Jun 25, 2026
@RyanCavanaugh

Copy link
Copy Markdown
Member

I'm going to merge this into main but I don't think we're going to do a patch release for just this one, given that it's not a 6.0 regression and is fixed in 7.0. If another critical issue (or handful of smaller ones) shows up we'll roll this into any future patch. Thanks!

@RyanCavanaugh RyanCavanaugh added this pull request to the merge queue Jun 25, 2026
Merged via the queue into microsoft:main with commit 637d574 Jun 25, 2026
22 checks passed
@github-project-automation github-project-automation Bot moved this from Needs merge to Done in PR Backlog Jun 25, 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: Done

Development

Successfully merging this pull request may close these issues.

Parser hangs on comment ending with -*/

3 participants