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

   # Which issue does this PR close?
   
   - None.
   
   # Rationale for this change
   
   `FixedSizeBinaryArray::value_offset_at` cast the requested index to `i32` 
before multiplying by the element width. For indexes beyond `i32::MAX`, that 
truncation could produce a negative byte offset and cause `value()` / 
`value_unchecked()` to read before the start of the value buffer.
   
   # What changes are included in this PR?
   
   This updates `FixedSizeBinaryArray` to compute internal byte offsets with 
`usize` arithmetic and to use pointer addition with the widened offset in 
`value_unchecked()`.
   
   `value_offset()` now checks the conversion back to `i32` and panics on 
overflow instead of silently truncating.
   
   This also adds regression tests covering the `i32::MAX` boundary and the 
checked `value_offset()` overflow path.
   
   # Are these changes tested?
   
   Yes. This adds regression tests around the truncation boundary and validates 
them in both debug and release builds.
   
   Validated with:
   
   ```bash
   cargo test -p arrow-array value_offset_
   cargo test -p arrow-array 
test_fixed_size_binary_array_get_value_index_out_of_bound
   cargo test -p arrow-array value_offset_ --release
   ```
   
   # Are there any user-facing changes?
   
   `FixedSizeBinaryArray::value()` and `value_unchecked()` now handle large 
valid indexes without truncating the computed byte offset. `value_offset()` now 
panics on offsets that cannot be represented as `i32` instead of silently 
wrapping. 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