Skip to content

fix: avoid index-out-of-bounds panic in staging apply_selection#2955

Merged
extrawurst merged 2 commits into
gitui-org:masterfrom
SAY-5:say-fix-staging-oob
Jul 1, 2026
Merged

fix: avoid index-out-of-bounds panic in staging apply_selection#2955
extrawurst merged 2 commits into
gitui-org:masterfrom
SAY-5:say-fix-staging-oob

Conversation

@SAY-5

@SAY-5 SAY-5 commented May 21, 2026

Copy link
Copy Markdown
Contributor

This Pull Request fixes/closes #2953.

It changes the following:

  • NewFromOldContent::add_old_line and catchup_to_hunkstart no longer index old_lines past its length, so unstaging or discarding lines near the end of a diff returns the working content unchanged instead of aborting with index out of bounds.
  • Added two unit tests against NewFromOldContent that exercise the previously panicking path.

I followed the checklist:

  • I added unittests
  • I ran make check without errors
  • I tested the overall application
  • I added an appropriate item to the changelog

@extrawurst extrawurst merged commit 8b7a74e into gitui-org:master Jul 1, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Index out of bounds

2 participants