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

Fix FFI handling of optional memflow connector_args #254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ajkhoury
Copy link
Contributor

As stated in the libmicrovmi documentation, memflow_connector_args are optional, however omitting the memflow_connector_args from the FFI causes an assertion failure in std::slice::from_raw_parts. The documentation for std::slice::from_raw_parts states that the pointer must be non-null and properly aligned, since it promises to return a slice that actually refers to valid memory. Prior to these changes, the code would attempt to pass a null pointer via args_arr to std::slice::from_raw_parts if the optional memflow_connector_args were not provided.

…nter usage

As stated in the documentation, memflow_connector_args are optional, however omitting the memflow_connector_args from the FFI causes an assertion failure in `std::slice::from_raw_parts`. The documentation for `std::slice::from_raw_parts` states that the pointer must be non-null and properly aligned, since it promises to return a slice that actually refers to valid memory. Prior to these changes, the code would attempt to pass a null pointer via args_arr to `std::slice::from_raw_parts` if the optional `memflow_connector_args` were not provided.
@Wenzel
Copy link
Owner

Wenzel commented Mar 12, 2025

Thanks for this PR @ajkhoury ! 🚀

I just fixed the Doc / book CI (actions/cache was deprecated)
Can you fix the formatting and rebase your branch on master ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants