Skip to content

test: add overflow tests for MutableBuffer#9958

Open
SoimanVasile wants to merge 1 commit into
apache:mainfrom
SoimanVasile:buffer-overflow-tests
Open

test: add overflow tests for MutableBuffer#9958
SoimanVasile wants to merge 1 commit into
apache:mainfrom
SoimanVasile:buffer-overflow-tests

Conversation

@SoimanVasile
Copy link
Copy Markdown

Description

While analyzing the memory allocation logic in MutableBuffer, I identified that the with_capacity and reserve methods correctly use .expect() guards to prevent integer overflows.

However, I couldnt find test cases for this .expect() guard in the current test suite. This PR adds 2 #[should_panic] tests in mutable.rs to verify that the API correctly panics
Changes:

  • Added test_mutable_new_capacity_overflow to cover MutableBuffer::new
  • Added test_mutable_reserve_overflow to cover MutableBuffer::reserve

Rationale

Adding these tests ensures that the safety guards in arrow-buffer remain intact and provides explicit coverage for edge cases involving near-usize::MAX allocations.

Tests

  • test_mutable_new_capacity_overflow
  • test_mutable_reserve_overflow

@github-actions github-actions Bot added the arrow Changes to the arrow crate label May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant