Jefffrey opened a new issue, #12409:
URL: https://github.com/apache/arrow-rs/issues/12409

   ### Describe the bug
   
   When constructing a `FixedSizeBinaryArray`, if the given buffer bytes don't 
divide evenly by the `value_size`, we have trailing bytes which can be returned 
by APIs. For example:
   
   ```rust
       #[test]
       fn test123() {
           let array = FixedSizeBinaryArray::new(3, vec![0_u8; 10].into(), 
None);
           assert_eq!(array.len(), 3); // 3 * 3 = 9
           assert_eq!(array.value_data().len(), 10); // 1 trailing byte
       }
   ```
   
   This test currently passes. This can be confusing, and can lead to bugs in 
other APIs. For example:
   
   
https://github.com/apache/arrow-rs/blob/f1ca38f949f7737d807a727535e175cf9ecd7c9d/arrow-array/src/builder/fixed_size_binary_builder.rs#L95-L110
   
   - Lines 102 & 103 assume that all bytes are part of the array; however if we 
have trailing bytes, these can be appended and corrupt the data of the builder
   
   ### To Reproduce
   
   _No response_
   
   ### Expected behavior
   
   Fix to ensure we strip trailing bytes, so we have a consistent view of only 
the bytes involved in the array
   
   ### Additional context
   
   _No response_
   
   ### Willingness to contribute
   
   I cannot contribute a fix for this bug at this time


-- 
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