Skip to content

fix: don't advance past EOF on an unterminated Unicode code point escape - #18607

Merged
JLHwung merged 1 commit into
jlhwung/fix-parser-recovery-label-redeclaration-quadraticfrom
jlhwung/fix-parser-recovery-unterminated-code-point-escape
Nov 12, 2026
Merged

JLHwung merged 1 commit into
jlhwung/fix-parser-recovery-label-redeclaration-quadraticfrom
jlhwung/fix-parser-recovery-unterminated-code-point-escape

Conversation

@JLHwung

@JLHwung JLHwung commented Nov 12, 2026

Copy link
Copy Markdown
Contributor
Q                       A
Fixed Issues? Babel parser genearted end > input.length EOF on invalid input \u{
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
Need backport? No
License MIT

When errorRecovery is true, on input \u{ without a closing brace, babel-parser advanced past EOF, generated end location > the input length.

Here we check the } first and exit early when there is no closing }

Assisted-by: Claude Fable 5.1

@JLHwung JLHwung added PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: parser 7.x: needs backport labels Nov 12, 2026
@JLHwung
JLHwung added this pull request to stack #18605 November 12, 2026 03:32
@babel-bot

babel-bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/63265

@pkg-pr-new

pkg-pr-new Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

commit: 34b7481

When errorRecovery is true, on input `\u{` without a closing brace, babel-parser advanced past EOF, generated end location >= the input length.

Here we check the `}` first and exit early when there is no closing `}`

Assisted-by: Claude Fable 5.1
@JLHwung
JLHwung force-pushed the jlhwung/fix-parser-recovery-unterminated-code-point-escape branch from 8a6be72 to 34b7481 Compare November 12, 2026 14:27
@JLHwung
JLHwung added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit c9c931a Nov 12, 2026
46 checks passed
@JLHwung
JLHwung deleted the jlhwung/fix-parser-recovery-unterminated-code-point-escape branch November 12, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

7.x: needs backport pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants