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);
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: Not started

Development

Successfully merging this pull request may close these issues.

Parser hangs on comment ending with -*/

2 participants