Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrowArray::try_from_raw Misleading Signature #3684

Closed
tustvold opened this issue Feb 9, 2023 · 1 comment · Fixed by #3685
Closed

ArrowArray::try_from_raw Misleading Signature #3684

tustvold opened this issue Feb 9, 2023 · 1 comment · Fixed by #3685
Assignees
Labels
arrow Changes to the arrow crate bug

Comments

@tustvold
Copy link
Contributor

tustvold commented Feb 9, 2023

Describe the bug

ArrowArray::try_from_raw accepts *const FFI_ArrowArray and *const FFI_ArrowSchema. As of #1449 no longer takes ownership of the pointers, and instead "moves" the contents into its own allocations. The method is unsafe, and so this technically isn't unsound, but it is fairly surprising to people unfamiliar with the interface who might assume they can pass in a const reference.

Related to this, the fact it doesn't take ownership makes it very easy to accidentally leak memory #1878 and #3683

To Reproduce

Expected behavior

Additional context

@tustvold tustvold added the bug label Feb 9, 2023
@tustvold tustvold self-assigned this Feb 9, 2023
tustvold added a commit to tustvold/arrow-rs that referenced this issue Feb 9, 2023
tustvold added a commit to tustvold/arrow-rs that referenced this issue Feb 9, 2023
tustvold added a commit that referenced this issue Feb 9, 2023
* Cleanup FFI interface (#3684) (#3683)

* Add import example

* Tweak doc example

* Use ManuallyDrop to model external memory
@tustvold
Copy link
Contributor Author

label_issue.py automatically added labels {'arrow'} from #3685

@tustvold tustvold added the arrow Changes to the arrow crate label Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant