Skip to content

Fix underflow in flat storage RowIterator after a clear.#12085

Merged
vorporeal merged 1 commit into
masterfrom
david/try-to-fix-row-iterator-oob
Jun 3, 2026
Merged

Fix underflow in flat storage RowIterator after a clear.#12085
vorporeal merged 1 commit into
masterfrom
david/try-to-fix-row-iterator-oob

Conversation

@vorporeal
Copy link
Copy Markdown
Contributor

@vorporeal vorporeal commented Jun 2, 2026

Description

Fixes the crash reported in Sentry issue WARP-CLIENT-BETA-STABLE-7TK6.

When flat storage had discarded prior scrollback, clearing all rows and then resizing rebuilt an empty row index with a zero content offset while the underlying content buffer retained its absolute offset. Materializing the next row could then underflow while indexing content and panic in RowIterator::next.

This preserves the existing absolute content offset when rebuilding an empty index and adds a regression test covering truncate-front, clear, resize, push, and row materialization.

Linked Issue

Testing

  • Verified the new regression test fails before the fix in release mode with the expected range start index ... out of range for slice of length 1024 panic.
  • cargo nextest run --manifest-path /Users/david/src/warp-2/Cargo.toml -p warp_terminal -E 'test(test_clear_after_truncate_front_then_resize_and_push_does_not_panic)'
  • cargo nextest run --release --manifest-path /Users/david/src/warp-2/Cargo.toml -p warp_terminal -E 'test(test_clear_after_truncate_front_then_resize_and_push_does_not_panic)'
  • cargo fmt --manifest-path /Users/david/src/warp-2/Cargo.toml -p warp_terminal -- --check

Manual validation and screenshots are not included because this fixes an internal flat-storage invariant that is directly reproduced by the unit regression test.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

Changelog Entries for Stable

CHANGELOG-BUG-FIX: Fixed a crash that could occur after clearing and resizing a terminal with scrollback.

Co-Authored-By: Oz oz-agent@warp.dev

@cla-bot cla-bot Bot added the cla-signed label Jun 2, 2026
Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vorporeal vorporeal requested a review from alokedesai June 2, 2026 19:01
@vorporeal vorporeal marked this pull request as ready for review June 2, 2026 19:01
@vorporeal vorporeal enabled auto-merge (squash) June 2, 2026 19:01
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented Jun 2, 2026

@vorporeal

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR updates flat storage index rebuilding to preserve the absolute content offset when resizing an empty index after scrollback truncation and clear, and adds a focused regression test for the crash path.

Concerns

  • No blocking correctness, security, or spec-alignment concerns found in the reviewed diff.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@vorporeal vorporeal merged commit 388f5dc into master Jun 3, 2026
48 checks passed
@vorporeal vorporeal deleted the david/try-to-fix-row-iterator-oob branch June 3, 2026 16:10
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.

2 participants