mbutrovich commented on issue #11593:
URL: https://github.com/apache/arrow-rs/issues/11593#issuecomment-6215924262

   The same check also panics in debug builds. When the falsy value is inlined, 
the view bytes that hold value bytes 4 to 7 are read as a buffer index and 
added to the number of truthy buffers 
([zip.rs](https://github.com/apache/arrow-rs/blob/ce110bba0277405a7c2a5903468fb342634aefe3/arrow-select/src/zip.rs#L824-L825)).
 A large enough value overflows the `u32` addition:
   
   ```rust
   use arrow_array::{BinaryViewArray, BooleanArray, Scalar};
   use arrow_select::zip::zip;
   
   fn main() {
       // A 12-byte value is inlined, and its bytes 8 to 11 are 0xFF. Each 
slice keeps a data buffer
       let t = BinaryViewArray::from(vec![&b"x"[..], b"another value longer 
than twelve"]).slice(0, 1);
       let f = BinaryViewArray::from(vec![&[0xFFu8; 12][..], b"a value longer 
than twelve bytes"]).slice(0, 1);
       let _ = zip(&BooleanArray::from(vec![true, false]), &Scalar::new(&t), 
&Scalar::new(&f));
       // debug build: panics with "attempt to add with overflow"
   }
   ```
   
   Checking the view's length instead of the buffers, as above, would avoid 
this too.


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