Skip to content

fix(types): fix bounds check in split_regex_literal#8606

Merged
dyc3 merged 1 commit intomainfrom
dyc3/fix-regex-bounds-check
Dec 28, 2025
Merged

fix(types): fix bounds check in split_regex_literal#8606
dyc3 merged 1 commit intomainfrom
dyc3/fix-regex-bounds-check

Conversation

@dyc3
Copy link
Contributor

@dyc3 dyc3 commented Dec 28, 2025

Summary

Fixes a bounds check that was allowing invalid text ranges to be constructed.

fixes #8563

Test Plan

No changes to snapshots

Docs

@changeset-bot
Copy link

changeset-bot bot commented Dec 28, 2025

🦋 Changeset detected

Latest commit: 023ac45

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added L-JavaScript Language: JavaScript and super languages A-Type-Inference Area: type inference labels Dec 28, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 28, 2025

Walkthrough

The boundary check in split_regex_literal was changed from open_index == close_index to open_index >= close_index. As a result, the function now returns None when the opening boundary is at or beyond the closing boundary, preventing creation of invalid regex literals and avoiding generation of invalid text ranges that could violate downstream assertions.

Pre-merge checks and finishing touches

✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the core change: fixing a bounds check in the split_regex_literal function to prevent invalid text ranges.
Description check ✅ Passed The description clearly states the problem being solved: fixing a bounds check allowing invalid text ranges, references issue #8563, and indicates no snapshot changes.
Linked Issues check ✅ Passed The PR directly addresses issue #8563 by preventing construction of invalid inverted text ranges through corrected bounds checking in split_regex_literal [#8563].
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the bounds check in split_regex_literal and adding a changelog entry; no unrelated modifications detected.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dyc3/fix-regex-bounds-check

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a831647 and 023ac45.

📒 Files selected for processing (2)
  • .changeset/khaki-vans-learn.md
  • crates/biome_js_type_info/src/local_inference.rs
✅ Files skipped from review due to trivial changes (1)
  • .changeset/khaki-vans-learn.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_js_type_info/src/local_inference.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: Test Node.js API
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Check Dependencies
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: autofix

Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 28, 2025

CodSpeed Performance Report

Merging #8606 will not alter performance

Comparing dyc3/fix-regex-bounds-check (023ac45) with main (df8fe06)

Summary

✅ 58 untouched
⏩ 95 skipped1

Footnotes

  1. 95 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Probably need a changeset

@dyc3 dyc3 force-pushed the dyc3/fix-regex-bounds-check branch from a831647 to 023ac45 Compare December 28, 2025 23:12
@dyc3 dyc3 merged commit f50723b into main Dec 28, 2025
17 checks passed
@dyc3 dyc3 deleted the dyc3/fix-regex-bounds-check branch December 28, 2025 23:27
@github-actions github-actions bot mentioned this pull request Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Type-Inference Area: type inference L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Frequent crashes due to assertion failure: start.raw <= end.raw

2 participants