alamb commented on code in PR #9910:
URL: https://github.com/apache/arrow-rs/pull/9910#discussion_r3190934108
##########
arrow-array/src/array/fixed_size_binary_array.rs:
##########
@@ -239,19 +216,14 @@ impl FixedSizeBinaryArray {
/// # Panics
/// Panics if index `i` is out of bounds.
pub fn value(&self, i: usize) -> &[u8] {
+ let len = self.len();
assert!(
- i < self.len(),
- "Trying to access an element at index {} from a
FixedSizeBinaryArray of length {}",
- i,
- self.len()
+ i < len,
+ "Trying to access an element at index {i} from a
FixedSizeBinaryArray of length {len}",
);
- let offset = i + self.offset();
+ let position = i * self.value_size;
unsafe {
- let pos = self.value_offset_at(offset);
- std::slice::from_raw_parts(
- self.value_data.as_ptr().offset(pos as isize),
Review Comment:
these casts as `as isize` and `as usize` I think are potentially susceptible
to (silent) overflows as wel
--
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]