alamb opened a new pull request, #9813:
URL: https://github.com/apache/arrow-rs/pull/9813

   # Which issue does this PR close?
   
   - None.
   
   # Rationale for this change
   
   `ArrayData::slice` checked bounds using unchecked `usize` addition. In 
optimized builds, very large `length` values could wrap `offset + length`, 
allowing invalid slice arguments to create `ArrayData` with inconsistent length 
and offset metadata instead of panicking.
   
   # What changes are included in this PR?
   
   This updates `ArrayData::slice` to use checked arithmetic when computing the 
slice end.
   
   The panic documentation is updated to describe the overflow case.
   
   # Are these changes tested?
   
   Yes. This adds a regression test covering a slice-of-slice call where 
`offset + length` overflows. The new regression was also verified in release 
mode.
   
   Validated with:
   
   ```bash
   cargo test -p arrow-data test_slice
   cargo test -p arrow-data
   cargo +stable fmt --all -- --check
   git diff --check
   cargo test -p arrow-data test_slice_panics_on_offset_length_overflow 
--release
   ```
   
   # Are there any user-facing changes?
   
   Invalid `ArrayData::slice` arguments where `offset + length` overflows now 
panic consistently across build modes. There are no API changes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to