mbutrovich opened a new issue, #12285: URL: https://github.com/apache/arrow-rs/issues/12285
#### Describe the bug `FixedSizeBinaryBuilder::append_value` compares `self.value_length != value.as_ref().len() as i32` ([fixed_size_binary_builder.rs](https://github.com/apache/arrow-rs/blob/d65329d3e71f4276ce41c8675446d178cecfc1fa/arrow-array/src/builder/fixed_size_binary_builder.rs#L66-L77)). The `as i32` cast truncates, so a slice whose length is `value_length + k * 2^32` passes the check. The builder then appends every byte of it but counts one value. Later values read from the wrong position, and `value_data()` is longer than `len * value_length`, which violates the `FixedSizeBinaryArray::new_unchecked` contract that `finish` relies on. With `force_validate`, `finish` panics instead. #### To Reproduce This needs about 8 GiB of memory. ```rust let mut b = FixedSizeBinaryBuilder::new(1); let big = vec![0u8; (1usize << 32) + 1]; assert!(b.append_value(&big).is_err()); // currently Ok ``` #### Expected behavior `append_value` should return an error for any slice whose length isn't `value_length`. Comparing as `usize` fixes it: `value.as_ref().len() != self.value_length as usize`. `with_capacity` already asserts `value_length >= 0`, so the cast is lossless. -- 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]
