Skip to content

fix: use line.len() - pos fallback in prisma migration slice - #3502

Closed
mmustafasenoglu wants to merge 1 commit into
rtk-ai:developfrom
mmustafasenoglu:fix/prisma-slice-panic
Closed

mmustafasenoglu wants to merge 1 commit into
rtk-ai:developfrom
mmustafasenoglu:fix/prisma-slice-panic

Conversation

@mmustafasenoglu

Copy link
Copy Markdown

Fixes #3445

Line 319 uses .unwrap_or(20) as the fallback when no whitespace is found after the migration token. If the token is shorter than 20 bytes and at end-of-line, this causes an out-of-bounds slice panic.

Line 252 in the same file already has the correct fallback: .unwrap_or(line.len() - pos). This PR applies the same fix to line 319.

Line 252 already uses .unwrap_or(line.len() - pos) for the same pattern.
Line 319 had .unwrap_or(20) which panics when the token is shorter than
20 bytes and sits at end-of-line with no trailing whitespace.

Closes #3445
Copilot AI lite review requested due to automatic review settings August 9, 2026 19:37
@CLAassistant

CLAassistant commented Aug 9, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@KuSh

KuSh commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Closing in favour of #3836, which applies the identical line.len() - pos fallback and adds the regression test that filter_migrate_status was missing, covering both the end of line id and the multibyte case. Review and comments are welcome there.

@KuSh KuSh closed this Sep 6, 2026
@KuSh KuSh added the duplicate This issue or pull request already exists label Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prisma_cmd.rs migration-name slice panics with out-of-bounds index when token is short and line-final

4 participants