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

   ### Describe the bug
   
   In ipc convert code, given a union with no type ids buffer and >128 fields, 
it panics instead of returning an error
   
   
https://github.com/apache/arrow-rs/blob/d03274a7f69d9ec18e2d74920f8b880dd0a722a0/arrow-ipc/src/convert.rs#L579-L584
   
   - the `None` branch here can panic as its not fallible
   
   ### To Reproduce
   
   ```rust
       #[test]
       fn try_fb_to_schema_union_without_type_ids_too_many_fields_is_err() {
           let mut fbb = FlatBufferBuilder::new();
           let null = crate::Null::create(&mut fbb, 
&crate::NullArgs::default());
           let child = crate::Field::create(
               &mut fbb,
               &crate::FieldArgs {
                   type_type: crate::Type::Null,
                   type_: Some(null.as_union_value()),
                   ..Default::default()
               },
           );
           let children = fbb.create_vector(&[child; 129]);
           let union = crate::Union::create(&mut fbb, 
&crate::UnionArgs::default());
           let field = crate::Field::create(
               &mut fbb,
               &crate::FieldArgs {
                   type_type: crate::Type::Union,
                   type_: Some(union.as_union_value()),
                   children: Some(children),
                   ..Default::default()
               },
           );
           assert_single_field_schema_is_err(fbb, field);
       }
   ```
   
   ```sh
   failures:
   
   ---- 
convert::tests::try_fb_to_schema_union_without_type_ids_too_many_fields_is_err 
stdout ----
   
   thread 
'convert::tests::try_fb_to_schema_union_without_type_ids_too_many_fields_is_err'
 (1141386) panicked at arrow-schema/src/fields.rs:503:42:
   UnionFields cannot contain more than 128 fields: TryFromIntError(PosOverflow)
   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
   
   
   failures:
       
convert::tests::try_fb_to_schema_union_without_type_ids_too_many_fields_is_err
   
   test result: FAILED. 141 passed; 1 failed; 0 ignored; 0 measured; 0 filtered 
out; finished in 3.55s
   ```
   
   ### Expected behavior
   
   Should return an error, not panic
   
   ### Additional context
   
   Reported by Adam Korczynski from ADA Logics, identified by Anthropic


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