cyphercodes opened a new pull request, #10289: URL: https://github.com/apache/arrow-rs/pull/10289
# Which issue does this PR close? - Closes #10286. # Rationale for this change `FFI_ArrowSchema::empty()` leaves `private_data` null. Calling the safe `with_metadata` builder on that value previously reached `Box::from_raw(self.private_data as *mut SchemaPrivateData)`, which is undefined behavior for a null pointer. # What changes are included in this PR? - Return a `CDataInterface` error from `FFI_ArrowSchema::with_metadata` when `private_data` is null. - Add a regression test for calling `with_metadata` on `FFI_ArrowSchema::empty()`. # Are these changes tested? Yes: - `cargo fmt -p arrow-schema -- --check` - `cargo test -p arrow-schema --features ffi test_set_metadata_on_empty_schema_errors -- --nocapture` - `cargo test -p arrow-schema --features ffi test_set_field_metadata -- --nocapture` - `cargo test -p arrow-schema --features ffi ffi::tests::test_schema -- --nocapture` - `cargo test -p arrow-schema --features ffi` - `cargo clippy -p arrow-schema --features ffi --all-targets -- -D warnings` # Are there any user-facing changes? No API shape changes. Calling `with_metadata` on an empty/released FFI schema now returns an error instead of invoking undefined behavior. # AI assistance AI assistance was used to prepare this small patch; I reviewed the change and verified it with the commands listed above. -- 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]
